Diagonalization Fixed Point Exercises

by Scott Garrabrant, Sam Eisenstat2 min read18th Nov 201813 comments

12

Fixed Point Theorems
Frontpage

This is the second of three sets of fixed point exercises. The first post in this sequence is here, giving context.

  1. Recall Cantor’s diagonal argument for the uncountability of the real numbers. Apply the same technique to convince yourself than for any set , the cardinality of is less than the cardinality of the power set (i.e. there is no surjection from to ).

  2. Suppose that a nonempty set has a function from to which lacks fixed points (i.e. for all ). Convince yourself that there is no surjection from S to , for any nonempty . (We will write the set of functions from to either as or ; these are the same.)

  3. For nonempty and , suppose you are given a surjective function from the set to the set of functions from to , and let be a function from to itself. The previous result implies that there exists an in such that . Can you use your proof to describe in terms of and ?

  4. Given sets and , let denote the space of total computable functions from to . We say that a function from to is computable if and only if the corresponding function (given by is computable. Show that there is no surjective computable function from the set of all strings to .

  5. Show that the previous result implies that there is no computable function from which outputs if and only if the first input is a code for a Turing machine that halts when given the second input.

  6. Given topological spaces and , let be the space with the set of continuous functions from to as its underlying set, and with topology such that is continuous if and only if the corresponding function (given by ) is continuous, assuming such a space exists. Convince yourself that there is no space which continuously surjects onto , where is the circle.

  7. In your preferred programming language, write a quine, that is, a program whose output is a string equal to its own source code.

  8. Write a program that defines a function taking a string as input, and produces its output by applying to its source code. For example, if reverses the given string, then the program should outputs its source code backwards.

  9. Given two sets and of sentences, let be the set of all functions from to defined by substituting the Gödel number of a sentence in into a fixed formula. Let be the set of all sentences in the language of arithmetic with one unbounded universal quantifier and arbitrarily many bounded quantifiers, and let be the set of all formulas with one free variables of that same quantifier complexity. By representing syntax using arithmetic, it is possible to give a function that substitutes its second argument into its first argument. Pick some coding of formulas as natural numbers, where we denote the number coding for a formula as . Using this, show that for any formula , there is a formula such that .

  10. (Gödel's second incompleteness theorem) In the set , there is a formula such that holds iff the sentence is not provable in Peano arithmetic. Using this, show that Peano arithmetic cannot prove its own consistency.

  11. (Löb's theorem) More generally, the diagonal lemma states that for any formula with a single free variable, there is a formula such that, provably, . Now, suppose that Peano arithmetic proves that for some formula . Show that Peano arithmetic also proves itself. Some facts that you may need are that (a) when a sentence is provable, the sentence is itself provable, (b) Peano arithmetic proves this fact, that is, Peano arithmetic proves , for any sentence and (c) Peano arithmetic proves the fact that if and are provable, then is provable.

  12. (Tarski's theorem) Show that there does not exist a formula with one free variable such that for each sentence , the statement holds.

  13. Looking back at all these exercises, think about the relationship between them.


Please use the spoilers feature - the symbol '>' followed by '!' followed by space -in your comments to hide all solutions, partial solutions, and other discussions of the math. The comments will be moderated strictly to hide spoilers!

I recommend putting all the object level points in spoilers and including metadata outside of the spoilers, like so: "I think I've solved problem #5, here's my solution <spoilers>" or "I'd like help with problem #3, here's what I understand <spoilers>" so that people can choose what to read.

12

13 comments, sorted by Highlighting new comments since Today at 9:37 PM
New Comment

Ex 8: (in Python, using a reversal function)

def f(s):
return s[::-1]

dlmt = '"""'
code = """def f(s):
return s[::-1]

dlmt = '{}'
code = {}{}{}
code = code.format(dlmt, dlmt, code, dlmt)
print(f(code))"""
code = code.format(dlmt, dlmt, code, dlmt)
print(f(code))

Ex 4

Given a computable function , define a function by the rule . Then is computable, however, because for , we have that and .

Ex 5:

We show the contrapositive: given a function halt, we construct a surjective function from to as follows: enumerate all turing machines, such that each corresponds to a string. Given a , if does not decode to a turing machine, set . If it does, let denote that turning machine. Let with input first run halt; if halt returns , put out , otherwise will halt on input ; run on and put out the result.

Given a computable function , there is a string such that implements (if the turing thesis is true). Then , so that is surjective.

Ex 6:

Let be a parametrization of the circle given by . Given and , write to denote the point , where . First, note that, regardless of the topology on , it holds true that if is continuous, then so is for any , because given a basis element of the circle, we have which is open because is continuous.

Let be a continuous function from to . Then is continuous, and so is the diagonal function . Fix any , then given by is also continuous, but given any , one has and thus . It follows that is not surjective.

Ex 7:

I did it in java. There's probably easier ways to do this, especially in other languages, but it still works. It was incredibly fun to do. My basic idea was to have a loop iterate 2 times, the first time printing the program, the second time printing the printing command. Escaping the " characters is the biggest problem, the main idea here was to have a string q that equals " in the first iteration and " + q + " in the second. That second string (as part of the code in an expression where a string is printed) will print itself in the console output. Code:

package maths;public class Quine{public static void main(String[]args){for(int i=0;i<2;i++){String o=i==1?""+(char)34:"";String q=""+(char)34;q=i==1?q+"+q+"+q:q;String e=i==1?o+"+e);}}}":"System.out.print(o+";System.out.print(o+"package maths;public class Quine{public static void main(String[]args){for(int i=0;i<2;i++){String o=i==1?"+q+""+q+"+(char)34:"+q+""+q+";String q="+q+""+q+"+(char)34;q=i==1?q+"+q+"+q+"+q+"+q:q;String e=i==1?o+"+q+"+e);}}}"+q+":"+q+"System.out.print(o+"+q+";"+e);}}}

For #6, I have what looks to me like a counterexample. Possibly I am using the wrong definition of continuous function? I am taking this one as my source.

Take as the topological space the real line under the Euclidean topology. Let be the point in at radians rotation. This is surjective; all points in are mapped to infinitely many times. It is also continuous; For every and neighborhood there is a neighborhood such that ,

The partial functions f(x) from are also continuous by the same argument.

Currying doesn't preserve surjectivity. As a simple example, you can easily find a surjective function , but there are no surjective functions .

Ah, yes, that makes sense. I got distracted by the definition of 's topology

and applied it to surjectivity as well as continuity.

#1

Let f be such a surjection. Construct a member of P(S) outside f's image by differing from each f(x) in whether it contains x.

#2

A nonempty set has functions without a fixed point iff it has at least two elements. It suffices to show that there is no surjection from S to S -> 2, which is analogous to #1.

#3

T has only one element. Use that one.

#7 Haskell

source = "main = putStrLn (\"source = \" ++ show source ++ \"\\n\" ++ source)"
main = putStrLn ("source = " ++ show source ++ "\n" ++ source)

Is #8 supposed to read "Write a program that takes a function f taking a string as input as input, and produces its output by applying f to its source code. For example, if f reverses the given string, then the program should outputs its source code backwards."?

If so, here.

source = "onme = putStrLn $ f $ \"source = \" ++ show source ++ \"\\n\" ++ source"
onme f = putStrLn $ f $ "source = " ++ show source ++ "\n" ++ source

Ex 1

Exercise 1: Let and let . Suppose that , then let be an element such that . Then by definition, and . So , a contradiction. Hence , so that is not surjective.

Ex 2

Exercise 2: Since is nonempty, it contains at least one element . Let be a function without a fixed point, then , so that and are two different elements in (this is the only thing we shall use the function for).

Let for nonempty. Suppose by contradiction that is surjective. Define a map by the rule . Given any subset , let be given by Since is surjective, we find a such that . Then . This proves that is surjective, which contradicts the result from (a).

Ex 3

Exercise 3: By (2) we know that , and so and where . That means for any . and .

Q7 (Python):

Y = lambda s: eval(s)(s)
Y('lambda s: print("Y = lambda s: eval(s)(s)\\nY({s!r})")')

Q8 (Python):

Not sure about the interpretation of this one. Here's a way to have it work for any fixed (python function) f:

f = 'lambda s: "\\n".join(s.splitlines()[::-1])'

go = 'lambda s: print(eval(f)(eval(s)(s)))'

eval(go)('lambda src: f"f = {f!r}\\ngo = {go!r}\\neval(go)({src!r})"')

I am confused by the introductory statement for #9. Is this an accurate rephrasing?

By representing syntax using arithmetic, it is possible to define a function as follows:

Define with image in , such that:
substitutes the Goedel-number of into (creating ) and then substitutes the Goedel-number of into some fixed formula to get a result in .

I’m confused about Q9.

Given the way is defined, it’s unclear to me how we ensure type correctness of . In what sense is a set of sentences (rather than a set of pairs of sentences)? What does an element of that set look like?

Yeah, it is just functions that take in two sentences and put both their Godel numbers into a fixed formula (with 2 inputs).

Minor correction for #7: You probably want to say "nonempty quine" or "nontrivial quine". The trivial quine works in many languages.

My nontrivial answer for Q7, in Python:

with open("foo.py", "r") as foo:
print foo.read()

And for Q8:

def f(string):
return ''.join([chr(ord(c)+1) for c in string])

with open("foo.py", "r") as foo:
print f(foo.read())