Advanced Topics in Computability Theory Teodor Rus
[email protected]
The University of Iowa, Department of Computer Science
Computation Theory – p.1/36
Topics to be covered •
The recursion theorem
•
Logical theories
•
Turing-reducibility
•
Descriptive complexity
Computation Theory – p.2/36
The recursion theorem •
is a mathematical result that plays an important role in advanced work in the theory of computability
•
has connections to mathematical logic, theory of self-reproducing systems, and computer viruses
We introduce the recursion theorem looking first at the paradox of machine reproduction.
Computation Theory – p.3/36
Can machines self-reproduce? 1. Living things are machines 2. Living things can self-reproduce 3. Machines cannot self-reproduce
Computation Theory – p.4/36
Living things are machines •
This is a doctrine of modern biology: organisms operate in a mechanistic way
Computation Theory – p.5/36
Living things can self-reproduce •
The ability to self-reproduce is an essential characteristic of every biological species
Computation Theory – p.6/36
Machine cannot self-reproduce •
Consider a machine (factory) that can construct other machines
•
Factory must be more complex than the machines it produces. I.e., designing the factory would be more complex than designing what it produces. This must be true because factory designs must have the design of its products as components
•
Consequently, no machine can construct itself, and thus self-reproduction in impossible
Computation Theory – p.7/36
Where is the error? •
Step 3 of the paradox is incorrect.
Making
machines that reproduce themselves is possible •
The recursion theorem shows how to do so
Computation Theory – p.8/36
Self-Reference Let us design a TM SELF that ignores its input and prints out a copy of its own description There is a computable function q : Σ∗ → Σ∗ , where for any string w, q(w) is the description of a TM Pw that prints out w and then halts.
Lemma:
Computation Theory – p.9/36
Proof Build w in Pw . Hence, the TM that computes q(w) is: Q = "On input string w 1. Construct the follow TM Pw : Pw = "On any input: (a) Erase input (b) Write w on the tape (c) Halt 2. Output hPw i."
Computation Theory – p.10/36
Constructing SELF •
SELF has two parts, called A and B
•
A and B are two separated procedures
•
SELF prints out hSELF i = hABi
Computation Theory – p.11/36
Note •
Part A runs first and upon completion passes control to B
•
The job of A is to print out a description of B and the job of B is to print out a description of A
•
Together they make up SELF but they operate differently
Computation Theory – p.12/36
Part A •
Use the machine PhBi , described by q(hBi)
•
Thus, A is a TM that prints hBi
the description of A depends on the description of B, hence we cannot complete it until we construct B. Note:
Computation Theory – p.13/36
Part B define B using q(hAi). This is bad because it would be a circular definition of an object in terms of itself
• Bad idea:
B computes A from the output that A produces
• A good idea:
Computation Theory – p.14/36
Note •
We defined A to be q(hBi)
•
If B can obtain hBi it can apply q to that to obtain hAi
•
Since q(w) is the TM that prints w, B obtains hBi on the tape as the result of A.
•
After computing q(hBi) = hAi, B adds this result to the front of the tape. Hence, the tape contains hABi = hSELF i.
Computation Theory – p.15/36
Summary, Figure 1 •
A = PhBi
•
B = "On input hM i where M is a portion of a TM 1. Compute q(hM i) 2. Combine the result with hM i to make a complete TM description 3. Print this description and halt."
Computation Theory – p.16/36
Schematic of SELF A(= PhBi )
-
B
?
...
Figure 1: SELF : prints its own description
Computation Theory – p.17/36
Behavior of SELF If we run SELF we observe the behavior: 1. First A runs and prints on the tape hBi 2. B starts when A halts. It looks at the tape and finds its input hBi. 3. Calculate q(hBi) = hAi and combines this result with hBi into a TM description, hSELF i 4. B prints this description and halts
Computation Theory – p.18/36
Note • We can implement this construction in any programming language to obtain a program that outputs a copy of itself. • We can even do so in plain English: command (by an English sentence) the reader to print a copy of the same sentence by: Print out this sentence • The above sentence has the desired meaning because it directs its reader to print a copy of itself • It doesn’t have an obvious translation in a programming language because the self-referenced word "this" in the sentence usually has no counterpart.
Computation Theory – p.19/36
The alternative • Print out two copies one in quotes: ‘‘Print second
•
out one
two
copies
of this
sentence,
of this
the
sentence,
second
the
in quotes:"
The part B of the construction is the clause: Print one
out
two
copies
of this
sentence,
the
second
in quotes:
•
Part A is the same, with quotes around it
•
A provides a copy of B to B so B can process that copy as TM does
Computation Theory – p.20/36
Relationship to recursion theorem •
Recursion theorem provides the ability to implement self-referential this into any programming language
•
With it, any program has the ability to refer to its own description, which has lot of applications
•
Recursion theorem extend the technique used in construction of SELF so that a program can obtain its own description and then go on to compute with it, instead of merely printing it out.
Computation Theory – p.21/36
Recursion Theorem Theorem 6.2 Let T be a TM that computes a function t : Σ∗ × Σ∗ → Σ∗ . There is a TM R that computes a function r : Σ∗ → Σ∗ , where for every w, r(w) = t(hRi, w). Note:
• To make a TM that can obtain its own description and then compute with it we need only to make a TM T that takes an extra-input that receives the description of the machine • Then the recursion theorem produces a new machine, R, which operates exactly as T does but with R’s description filled in automatically
Computation Theory – p.22/36
Proof The proof is similar to the construction of SELF . Construct R in three parts: A, B, and T , where T is the machine given in theorem • A is the TM PhBT i described by q(hBT i). After A runs, the tape contains hBT i • B is a procedure that examines the tape and applies q to its contents; the result is hAi. Then B combines A, B, and T into a single machine, writes its description on the tape, and pass control to T .
Computation Theory – p.23/36
Schematic of R A(= PhBT i ) -
B
-T ?
...
Figure 2: SELF : prints its own description
Computation Theory – p.24/36
Terminology •
If one designs a TM M one can include the phrase “obtain own description hM i" in the informal description of M ’s algorithm
•
M can use its own description as it would use any other computed value, for example M can print out hM i
•
Illustrate these with SELF
Computation Theory – p.25/36
SELF using RT RT stands for Recursion Theorem SELF = "On any input: 1. Obtain, via RT, own description hSELF i 2. Print hSELF i."
Computation Theory – p.26/36
Applications •
Computer viruses
•
Applications to undecidability
•
Minimal length description
•
Fixed-point theorem
Computation Theory – p.27/36
Computer virus, CV •
A CV is a computer program designed to spread itself among computers.
•
A CV is inactive when standing alone as a piece of code; when placed appropriately in a host computer it become activated reproducing itself, thus transmitting its copies to other accessible machines.
•
Various media can transmit viruses, including Internet and transferable disks.
Computation Theory – p.28/36
Application to undecidability Theorem 6.3
AT M is undecidable
let TM H decide AT M contradiction.
Proof:
for the purpose of obtaining a
Construct the TM B: B = "On input w: 1. Obtain, via RT, own description hBi. 2. Run H on hB, wi 3. If H rejects, accept; if H accepts reject."
Computation Theory – p.29/36
Note Running B on w does the opposite of what H declares it does. Therefore H cannot decide AT M
Computation Theory – p.30/36
Minimal length description If M is a TM then the length of the description hM i of M is the number of symbols in the string describing M
Definition 6.4
M is minimal if there is no TM equivalent to M that has a shorter description. Notation: M INT M = {hM i|M is a minimal T M }
Computation Theory – p.31/36
Theorem 6.5 M INT M is not Turing-recognizable Assume that some TM E enumerates M INT M and obtain a contradiction. Proof:
Construct TM C by: C= "On input w: 1. Obtain, via RT, own description hCi 2. Run the enumerator E until a machine D appears with a longer description than that of C. 3. Simulate D on w
Computation Theory – p.32/36
Note •
Because M INT M is infinite, E’s list must contain a TM with a longer description than C’s.
•
Therefore step 2 of C eventually terminates with some D
•
Then C simulates D and so is equivalent to it.
•
Because C is shorter than D and equivalent with D, D cannot be minimal.
•
But D appears on the list E produces. Thus we have a contradiction.
Computation Theory – p.33/36
Fixed-point application •
A fixed point x of a function f is a value that isn’t changed by application of the function to it, that is x = f (x)
•
Here we consider functions that are computable transformations of TM descriptions
•
We show that for any such transformation there is a TM whose behavior is unchanged by the transformation
Computation Theory – p.34/36
Theorem 6.6 Let t : Σ∗ → Σ∗ be a computable function. Then there is a TM F wherein t(hF i) describes a TM equivalent to F . Let F be the following TM F = "On input w:
Proof:
1. Obtain, via RT, own description hF i 2. Compute t(hF i) to obtain a TM G 3. Simulate G on w."
Computation Theory – p.35/36
Note hF i and (hF i) = G describe equivalent TM because F simulates G
Computation Theory – p.36/36