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

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

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

For nonempty S and T, suppose you are given g:S→TS a surjective function from the set S to the set of functions from S to T, and let f be a function from T to itself. The previous result implies that there exists an x in T such that f(x)=x. Can you use your proof to describe x in terms of f and g?

Given sets A and B, let Comp(A,B) denote the space of total computable functions from A to B. We say that a function from C to Comp(A,B) is computable if and only if the corresponding function f′:C×A→B (given by f′(c,a)=f(c)(a)) is computable. Show that there is no surjective computable function from the set S of all strings to Comp(S,{T,F}).

Show that the previous result implies that there is no computable function halt(x,y) from S×S→{T,F} which outputs T if and only if the first input is a code for a Turing machine that halts when given the second input.

Given topological spaces A and B, let Cont(A,B) be the space with the set of continuous functions from A to B as its underlying set, and with topology such that f:C→Cont(A,B) is continuous if and only if the corresponding function f′:C×A→B (given by f′(c,a)=f(c)(a)) is continuous, assuming such a space exists. Convince yourself that there is no space X which continuously surjects onto Cont(X,S), where S is the circle.

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

Write a program that defines a function f taking a string 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.

Given two sets A and B of sentences, let Syn(A,B) be the set of all functions from A to B defined by substituting the Gödel number of a sentence in A into a fixed formula. Let S0 be the set of all sentences in the language of arithmetic with one unbounded universal quantifier and arbitrarily many bounded quantifiers, and let S1 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 f∈Syn(S1×S1,S0) 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 ϕ∈S1, there is a formula ψ∈S0 such that ϕ(┌ψ┐)↔ψ.

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

(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 Bew(ψ)→ψ 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 Bew(ψ) is itself provable, (b) Peano arithmetic proves this fact, that is, Peano arithmetic proves Bew(ψ)→Bew(Bew(ψ)), for any sentence ψ and (c) Peano arithmetic proves the fact that if χ and χ→ζ are provable, then ζ is provable.

(Tarski’s theorem) Show that there does not exist a formula ϕ with one free variable such that for each sentence ψ, the statement ϕ(┌ψ┐)↔ψ holds.

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.

Given a computable function ϕ:S↦Comp(S,{T,F}), define a function f:S↦{T,F} by the rule f(s)={Tϕ(s)(s)=FFϕ(s)(s)=T. Then f is computable, however, f∉ϕ(S) because for s∈S, we have that ϕ(s)(s)=F⟹f(s)=T⟹ϕ(s)≠f and ϕ(s)(s)=T⟹f(s)=F⟹ϕ(s)≠f.

Ex 5:

We show the contrapositive: given a function halt, we construct a surjective function f from S to Comp(S,{T,F}) as follows: enumerate all turing machines, such that each corresponds to a string. Given a t∈S, if t does not decode to a turing machine, set f(t)≡F. If it does, let [t] denote that turning machine. Let f(t) with input s∈S first run halt(t,s); if halt returns F, put out F, otherwise [t] will halt on input s; run [t] on s and put out the result.

Given a computable function g:S↦{T,F}, there is a string t∗∈S such that [t∗] implements g (if the turing thesis is true). Then g=f(t∗), so that f is surjective.

Ex 6:

Let h:R↦S be a parametrization of the circle given by h(r)↦(cos(r),sin(r)). Given p∈S and r∈R, write p+r to denote the point h(p′+r), where p′∈h−1({p}). First, note that, regardless of the topology on X, it holds true that if f:X↦S is continuous, then so is fr:x↦f(x)+r for any r∈R, because given a basis element (h(a),h(b)) of the circle, we have f−1r(B)=f−1(h(a)−r,h(b)−r) which is open because f is continuous.

Let ϕ be a continuous function from X to Cont(X,S). Then ϕ′:X×X↦S is continuous, and so is the diagonal function h:x↦ϕ(x,x). Fix any r∈(0,2π), then f:X↦S given by f:x↦(ϕ′(x,x)+r)) is also continuous, but given any x∈X, one has ϕ(x)(x)=ϕ′(x,x)≠ϕ′(x,x)+r=f(x) and thus ϕ(x)≠f. 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:

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 X the real line under the Euclidean topology. Let f′(x,y) be the point in S1 at (x+y) radians rotation. This is surjective; all points in S1 are mapped to infinitely many times. It is also continuous; For every (x,y)∈X,X and neighborhood N(f′(x,y)) there is a neighborhood M(x,y) such that ∀p∈M, f(p)∈N

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

Currying doesn’t preserve surjectivity. As a simple example, you can easily find a surjective function 2×2→2, but there are no surjective functions 2→22.

I am confused about this exercise. The standard/modern proof of Gödel’s second incompleteness theorem uses the Hilbert–Bernays–Löb derivability conditions, which are stated as (a), (b), (c) in exercise #11. If the exercises are meant to be solved in sequence, this seems to imply that #10 is solvable without using the derivability conditions. I tried doing this for a while without getting anywhere.

Maybe another way to state my confusion is that I’m pretty sure that up to exercise #10, nothing that distinguishes Peano arithmetic from Robinson arithmetic has been introduced (it is only with the introduction of the derivability conditions in #11 that this difference becomes apparent). It looks like there is a version of the second incompleteness theorem for Robinson arithmetic, but the paper says “The proof is by the construction of a nonstandard model in which this formula [i.e. formula expressing consistency] is false”, so I’m guessing this proof won’t work for Peano arithmetic.

Suppose for the sake of contradiction that such a formula ϕ exists. By the diagonal lemma applied to ¬ϕ, there is some sentence ψ such that, provably, ¬ϕ(┌ψ┐)↔ψ. By the soundness of our theory, in fact ¬ϕ(┌ψ┐)↔ψ. But by the property for ϕ we also have ϕ(┌ψ┐)↔ψ, which means ¬ϕ(┌ψ┐)↔ϕ(┌ψ┐), a contradiction.

This seems to be the “semantic” version of the theorem, where the property for ϕ is stated outside the system. There is also a “syntactic” version where the property for ϕ is stated within the system.

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

Exercise 1: Let f:S↦P(S) and let A={x∈S|x∉f(x)}. Suppose that A∈f(S), then let x∈S be an element such that f(x)=A. Then x∉f(x)=A⟹x∈A by definition, and x∈A=f(x)⟹x∉A. So x∉A⟺x∈A, a contradiction. Hence A∉f(S), so that f is not surjective.

Ex 2

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

Let Ψ:S↦TS for S nonempty. Suppose by contradiction that Ψ is surjective. Define a map f:S↦P(S) by the rule f(x)={s∈S|Ψ(x)(s)=t0}. Given any subset U⊂S, let g:S↦T be given by g:x↦{t0x∈Ut1x∉U Since Ψ is surjective, we find a s∗∈S such that Ψ(s∗)=g. Then f(s∗)=U. This proves that f is surjective, which contradicts the result from (a).

Ex 3

Exercise 3: By (2) we know that T={x}, and so f={(x,x)} and g={(s,h)|s∈S} where h={(s,x)|s∈S}. That means x=g(s)(s′)=fn(g(s)(s′)) for any s,s′∈S. and n∈N.

Define a formula ξ(v) taking one free variable to be f(┌ϕ┐,┌f(v,v)┐).

Now define ψ to be f(┌ξ┐,┌ξ┐). By the definition of f we have ψ↔ξ(┌ξ┐).

We have ϕ(┌ψ┐)↔f(┌ϕ┐,┌ψ┐)↔f(┌ϕ┐,┌f(┌ξ┐,┌ξ┐)┐)↔ξ(┌ξ┐)↔ψ

The first step follows by the definition of f, the second by the definition of ψ, the third by the definition of ξ, and the fourth by the property of ψ mentioned above. Since ψ∈S0 by the type signature of f, this completes the proof.

Things I’m not sure about:

It’s a little unclear to me what the Syn(A,B) notation means. In particular, I’ve assumed that f takes as inputs Gödel numbers of formulas rather than the formulas themselves. If f takes as inputs the formulas themselves, then I don’t think we can assume that the formula ξ exists without doing more arithmetization work (i.e. the equivalent of ξ would need to know how to convert from the Gödel number of a formula to the formula itself).

If the biconditional “↔” is a connective in the logic itself, then I think the same proof works but we would need to assume more about f than is given in the problem statement, namely that the theory we have can prove the substitution property of f.

The assumption about the quantifier complexity of S0 and S1 was barely used. It was just given to us in the type signature for f, and the same proof would have worked without this assumption, so I am confused about why the problem includes this assumption.

So, a proof can’t be “s2A” or “s2B” or “s2A” or “s2B” or “s2B” or “s2C” or “worlds” or “possible worlds” or “no known world”. But it might well be that the proof is correct enough given the premises.

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 f as follows:

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

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

Suppose there is a surjection f : S → P(S). Consider the set X={x∈S|x∉f(x)} . Since f is a surjection, X = f(y) for some y in S. Does y lie in X? If y∈X , then y∈f(y) , so by definition of X, y∉X . If y∉X , then y∉f(y), so y must belong to X. Contradiction.

Ex 2.

Since there is a function f:T→T without fixed points, T must have at least two elements. Hence, there is a surjection s:T→{0,1} , which induces a surjection TS→2S (a function g:S→T goes to s∘g ). So, if there were a surjection S→TS , there would also be a surjection S→2S , which cannot be by previous exercise.

Ex 4.

Suppose f:S→Comp(S,{T,F}) is a computable surjective function. Consider the function g:S→{T,S}defined by g(s)=¬f(s)(s). The function g is computable, therefore there should exist an s∗∈S: f(s∗)=g .

Then f(s∗)(s∗)=g(s∗)=¬f(s∗)(s∗) . Contradiction.

Ex 5.

Suppose halt(x,y) is a computable function. Consider the function f:S→{T,F}: f(s)=¬s(s) if halt(s,s); T if ¬halt(s,s)

Suppose s′ is a Turing code of f. Since f halts everywhere, halt(s’, s’) = T. But then s′(s′)=f(s′)=¬s′(s′) . Contradiction.

Ex 6.

Suppose that f:X→Cont(X,S) is a continuous surjection. Consider the function g∈Cont(X,S)g(x)=−f(x,x) (here—f(x, x) is a point diametrically opposed to f(x, x)). f is surjective, hence g = f(y), but then g(y) = f(y,y) = - f(y,y). Contradiction.

## Diagonalization Fixed Point Exercises

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

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

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

For nonempty S and T, suppose you are given g:S→TS a surjective function from the set S to the set of functions from S to T, and let f be a function from T to itself. The previous result implies that there exists an x in T such that f(x)=x. Can you use your proof to describe x in terms of f and g?

Given sets A and B, let Comp(A,B) denote the space of total computable functions from A to B. We say that a function from C to Comp(A,B) is computable if and only if the corresponding function f′:C×A→B (given by f′(c,a)=f(c)(a)) is computable. Show that there is no surjective computable function from the set S of all strings to Comp(S,{T,F}).

Show that the previous result implies that there is no computable function halt(x,y) from S×S→{T,F} which outputs T if and only if the first input is a code for a Turing machine that halts when given the second input.

Given topological spaces A and B, let Cont(A,B) be the space with the set of continuous functions from A to B as its underlying set, and with topology such that f:C→Cont(A,B) is continuous if and only if the corresponding function f′:C×A→B (given by f′(c,a)=f(c)(a)) is continuous, assuming such a space exists. Convince yourself that there is no space X which continuously surjects onto Cont(X,S), where S is the circle.

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

Write a program that defines a function f taking a string 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.

Given two sets A and B of sentences, let Syn(A,B) be the set of all functions from A to B defined by substituting the Gödel number of a sentence in A into a fixed formula. Let S0 be the set of all sentences in the language of arithmetic with one unbounded universal quantifier and arbitrarily many bounded quantifiers, and let S1 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 f∈Syn(S1×S1,S0) 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 ϕ∈S1, there is a formula ψ∈S0 such that ϕ(┌ψ┐)↔ψ.

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

(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 Bew(ψ)→ψ 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 Bew(ψ) is itself provable, (b) Peano arithmetic proves this fact, that is, Peano arithmetic proves Bew(ψ)→Bew(Bew(ψ)), for any sentence ψ and (c) Peano arithmetic proves the fact that if χ and χ→ζ are provable, then ζ is provable.

(Tarski’s theorem) Show that there does not exist a formula ϕ with one free variable such that for each sentence ψ, the statement ϕ(┌ψ┐)↔ψ holds.

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.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 ϕ:S↦Comp(S,{T,F}), define a function f:S↦{T,F} by the rule f(s)={Tϕ(s)(s)=FFϕ(s)(s)=T. Then f is computable, however, f∉ϕ(S) because for s∈S, we have that ϕ(s)(s)=F⟹f(s)=T⟹ϕ(s)≠f and ϕ(s)(s)=T⟹f(s)=F⟹ϕ(s)≠f.

Ex 5:

We show the contrapositive: given a function halt, we construct a surjective function f from S to Comp(S,{T,F}) as follows: enumerate all turing machines, such that each corresponds to a string. Given a t∈S, if t does not decode to a turing machine, set f(t)≡F. If it does, let [t] denote that turning machine. Let f(t) with input s∈S first run halt(t,s); if halt returns F, put out F, otherwise [t] will halt on input s; run [t] on s and put out the result.

Given a computable function g:S↦{T,F}, there is a string t∗∈S such that [t∗] implements g (if the turing thesis is true). Then g=f(t∗), so that f is surjective.

Ex 6:

Let h:R↦S be a parametrization of the circle given by h(r)↦(cos(r),sin(r)). Given p∈S and r∈R, write p+r to denote the point h(p′+r), where p′∈h−1({p}). First, note that, regardless of the topology on X, it holds true that if f:X↦S is continuous, then so is fr:x↦f(x)+r for any r∈R, because given a basis element (h(a),h(b)) of the circle, we have f−1r(B)=f−1(h(a)−r,h(b)−r) which is open because f is continuous.

Let ϕ be a continuous function from X to Cont(X,S). Then ϕ′:X×X↦S is continuous, and so is the diagonal function h:x↦ϕ(x,x). Fix any r∈(0,2π), then f:X↦S given by f:x↦(ϕ′(x,x)+r)) is also continuous, but given any x∈X, one has ϕ(x)(x)=ϕ′(x,x)≠ϕ′(x,x)+r=f(x) and thus ϕ(x)≠f. 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 X the real line under the Euclidean topology. Let f′(x,y) be the point in S1 at (x+y) radians rotation. This is surjective; all points in S1 are mapped to infinitely many times. It is also continuous; For every (x,y)∈X,X and neighborhood N(f′(x,y)) there is a neighborhood M(x,y) such that ∀p∈M, f(p)∈N

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

Currying doesn’t preserve surjectivity. As a simple example, you can easily find a surjective function 2×2→2, but there are no surjective functions 2→22.

Ah, yes, that makes sense. I got distracted by the definition of Cont(A,B)’s topology

and applied it to surjectivity as well as continuity.

Thoughts on #10:

I am confused about this exercise. The standard/modern proof of Gödel’s second incompleteness theorem uses the Hilbert–Bernays–Löb derivability conditions, which are stated as (a), (b), (c) in exercise #11. If the exercises are meant to be solved in sequence, this seems to imply that #10 is solvable without using the derivability conditions. I tried doing this for a while without getting anywhere.

Maybe another way to state my confusion is that I’m pretty sure that up to exercise #10, nothing that distinguishes Peano arithmetic from Robinson arithmetic has been introduced (it is only with the introduction of the derivability conditions in #11 that this difference becomes apparent). It looks like there is a version of the second incompleteness theorem for Robinson arithmetic, but the paper says “The proof is by the construction of a nonstandard model in which this formula [i.e. formula expressing consistency] is false”, so I’m guessing this proof won’t work for Peano arithmetic.

My solution for #12:

Suppose for the sake of contradiction that such a formula ϕ exists. By the diagonal lemma applied to ¬ϕ, there is some sentence ψ such that, provably, ¬ϕ(┌ψ┐)↔ψ. By the soundness of our theory, in fact ¬ϕ(┌ψ┐)↔ψ. But by the property for ϕ we also have ϕ(┌ψ┐)↔ψ, which means ¬ϕ(┌ψ┐)↔ϕ(┌ψ┐), a contradiction.

This seems to be the “semantic” version of the theorem, where the property for ϕ is stated outside the system. There is also a “syntactic” version where the property for ϕ is stated within the system.

#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

takesa function f taking a string as inputas 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 f:S↦P(S) and let A={x∈S|x∉f(x)}. Suppose that A∈f(S), then let x∈S be an element such that f(x)=A. Then x∉f(x)=A⟹x∈A by definition, and x∈A=f(x)⟹x∉A. So x∉A⟺x∈A, a contradiction. Hence A∉f(S), so that f is not surjective.

Ex 2

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

Let Ψ:S↦TS for S nonempty. Suppose by contradiction that Ψ is surjective. Define a map f:S↦P(S) by the rule f(x)={s∈S|Ψ(x)(s)=t0}. Given any subset U⊂S, let g:S↦T be given by g:x↦{t0x∈Ut1x∉U Since Ψ is surjective, we find a s∗∈S such that Ψ(s∗)=g. Then f(s∗)=U. This proves that f is surjective, which contradicts the result from (a).

Ex 3

Exercise 3: By (2) we know that T={x}, and so f={(x,x)} and g={(s,h)|s∈S} where h={(s,x)|s∈S}. That means x=g(s)(s′)=fn(g(s)(s′)) for any s,s′∈S. and n∈N.

Attempted solution and some thoughts on #9:

Define a formula ξ(v) taking one free variable to be f(┌ϕ┐,┌f(v,v)┐).

Now define ψ to be f(┌ξ┐,┌ξ┐). By the definition of f we have ψ↔ξ(┌ξ┐).

We have ϕ(┌ψ┐)↔f(┌ϕ┐,┌ψ┐)↔f(┌ϕ┐,┌f(┌ξ┐,┌ξ┐)┐)↔ξ(┌ξ┐)↔ψ

The first step follows by the definition of f, the second by the definition of ψ, the third by the definition of ξ, and the fourth by the property of ψ mentioned above. Since ψ∈S0 by the type signature of f, this completes the proof.

Things I’m not sure about:

It’s a little unclear to me what the Syn(A,B) notation means. In particular, I’ve assumed that f takes as inputs Gödel numbers of formulas rather than the formulas themselves. If f takes as inputs the formulas themselves, then I don’t think we can assume that the formula ξ exists without doing more arithmetization work (i.e. the equivalent of ξ would need to know how to convert from the Gödel number of a formula to the formula itself).

If the biconditional “↔” is a connective in the logic itself, then I think the same proof works but we would need to assume more about f than is given in the problem statement, namely that the theory we have can prove the substitution property of f.

The assumption about the quantifier complexity of S0 and S1 was barely used. It was just given to us in the type signature for f, and the same proof would have worked without this assumption, so I am confused about why the problem includes this assumption.

Here’s the proof from the paper again:

=f2N < ck0,0..c9k0> kk0k0k0k0k0r0..6l0r0k0r0k0r0k0r0r0r0k0r0r0k0r0r0k0.k0r0k0r0r0k0r0r0r0k0r0.k0r0ok<k0r0r0k0r0r0r0r0k0r0.k0r0r0.r0r0.k0r0r0r0r0..2r0r0.k0r0r0r0r0).

So, a proof can’t be “s2A” or “s2B” or “s2A” or “s2B” or “s2B” or “s2C” or “worlds” or “possible worlds” or “no known world”. But it might well be that the proof is correct enough given the premises.

So we assume the proof is correct!

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 f as follows:

Define f(s∈S1,t∈S1) with image in S0, such that:

f substitutes the Goedel-number of t into s (creating s′) and then substitutes the Goedel-number of s′ into some fixed formula to get a result in S0.

I’m confused about Q9.

Given the way Syn(A,B) is defined, it’s unclear to me how we ensure type correctness of Syn(S1×S1,S0). In what sense is S1×S1 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())

Ex 1.

Suppose there is a surjection f : S → P(S). Consider the set X={x∈S|x∉f(x)} . Since f is a surjection, X = f(y) for some y in S. Does y lie in X? If y∈X , then y∈f(y) , so by definition of X, y∉X . If y∉X , then y∉f(y), so y must belong to X. Contradiction.

Ex 2.

Since there is a function f:T→T without fixed points, T must have at least two elements. Hence, there is a surjection s:T→{0,1} , which induces a surjection TS→2S (a function g:S→T goes to s∘g ). So, if there were a surjection S→TS , there would also be a surjection S→2S , which cannot be by previous exercise.

Ex 4.

Suppose f:S→Comp(S,{T,F}) is a computable surjective function. Consider the function g:S→{T,S}defined by g(s)=¬f(s)(s). The function g is computable, therefore there should exist an s∗∈S: f(s∗)=g .

Then f(s∗)(s∗)=g(s∗)=¬f(s∗)(s∗) . Contradiction.

Ex 5.

Suppose halt(x,y) is a computable function. Consider the function f:S→{T,F}: f(s)=¬s(s) if halt(s,s); T if ¬halt(s,s)

Suppose s′ is a Turing code of f. Since f halts everywhere, halt(s’, s’) = T. But then s′(s′)=f(s′)=¬s′(s′) . Contradiction.

Ex 6.

Suppose that f:X→Cont(X,S) is a continuous surjection. Consider the function g∈Cont(X,S) g(x)=−f(x,x) (here—f(x, x) is a point diametrically opposed to f(x, x)). f is surjective, hence g = f(y), but then g(y) = f(y,y) = - f(y,y). Contradiction.

Ex 7. A quine in python3:

code = “”“code = {}{}{}{}{}{}{}

print(code.format(‘”’,‘”’,‘”’,code,‘”’,‘”’,‘”’))”””

print(code.format(‘”’,‘”’,‘”’,code,‘”’,‘”’,‘”’))

Ex 8. In python:

import inspect

def f(string):

return string[::-1]

def applytoself(f):

source = inspect.getsource(f)

return f(source)

applytoself(f)

‘\n]1-::[gnirts nruter \n:)gnirts(f fed’

Ex 9.

The formula for ψ is ∀x((x=┌ψ┐)→ϕ(x))

Ex 11.

Suppose ϕ is the formula Bew(x)→ψ . By the diagonal lemma, there exists a formula A such that ⊢A↔(Bew(A)→ψ) .

Therefore, ⊢Bew(A→(Bew(A)→ψ))

By property c, ⊢Bew(A)→Bew(Bew(A)→ψ)

Again by property c, ⊢Bew(Bew(A)→ψ)→(Bew(Bew(A))→Bew(ψ))

Combining previous two implications, ⊢Bew(A)→(Bew(Bew(A))→Bew(ψ))

Since ⊢Bew(A)→Bew(Bew(A)) , we have

⊢Bew(A)→Bew(ψ)

Combining this with ⊢Bew(ψ)→ψ , we get

⊢Bew(A)→ψ

From this we get ⊢A , therefore, ⊢Bew(A) and ⊢ψ . QED.