Lection 6 –

Recursive, .e. and semi-decidable sets Exercises On the total functions Rice theorem Undecidability of first-order logic

– p. 1 Recursive and r.e. Sets

Def. A set A is recursive if there exists a total f such that

1 if x ∈ A f(x) = ( 0 otherwise Recursive enumerable sets A set A is r.e. if it is empty or if there exists a total computable function g such that

A = C(g) where C(g) = {z |∃xg(x) = z}.

– p. 2 Semi-decidable Sets

Def. A set A is semi-decidable if there exists a computable function f such that A = D(f) = {x | f(x) ↓}, i.e.

1 if x ∈ A f(x) = ( ↑ otherwise

– p. 3 Dovetailing technique

Assume to have a partial function f and we want to find an n such that f(n) ↓.

– p. 4 Dovetailing technique

Assume to have a partial function f and we want to find an n such that f(n) ↓. y := 0, flag := T while flag := T do

a = α1(y), a = α2(y) if f(a) ↓ within b steps, then flag := F else, y := y +1 RETURN a

– p. 4 Relations

A set A is r.e. if it is empty or if there exists a total computable function g such that

A = C(g)

where C(g) = {z |∃xg(x) = z}. A set A is semi-decidable if there exists a computable function f such that A = D(f) = {x | f(x) ↓}, i.e.

1 if x ∈ A f(x) = ( ↑ otherwise

Theorem A semi-decidable = A r.e.

– p. 5 Questions

How about these sets?

A1 = {x | Φx(x) ↓}

A2 = {x | Φx(x) ↑}

– p. 6 Representation of functions

Def. Let F ⊆ Fcalc. I is a representation of F if

1. ∀i ∈ I ⇒ Φi ∈ F

2. ∀f ∈ F ⇒ i ∈ I such that f ≃ Φi

– p. 7 Representation of functions

Def. Let F ⊆ Fcalc. I is a representation of F if

1. ∀i ∈ I ⇒ Φi ∈ F

2. ∀f ∈ F ⇒ i ∈ I such that f ≃ Φi F is recursive (or r.e.) if at least one of its representation is.

– p. 7 Total Functions

The class of total computable functions has no representation that is r.e.; in particular

I = {x | Φx is total } is not r.e.

– p. 8 Total Functions

The class of total computable functions has no representation that is r.e.; in particular

I = {x | Φx is total } is not r.e. Corollary: Any formalism that computes only total functions, cannot compute of them.

– p. 8 Rice’s Theorem

Very powerful tool to prove negative results about recursive sets.

– p. 9 Extensional Properties

An extensional property is a property that depends only on the behaviour of the machine ond not its internal construction

– p. 10 Extensional Properties

An extensional property is a property that depends only on the behaviour of the machine ond not its internal construction

Def. Let I = {i | Φi ∈ A}. I is extensional if for all i, j

i ∈ I ∧ φi ≃ φj → j ∈ I

(set of all indexes of programs that compute a certain set of functions)

– p. 10 Extensional Sets – examples

– p. 11 Extensional Sets – examples

{i | φi is total } ?

– p. 11 Extensional Sets – examples

{i | φi is total } ?

{i | φi(i) ↓} ?

– p. 11 Extensional Sets – examples

{i | φi is total } ?

{i | φi(i) ↓} ?

{i | φi(0) ↑} ?

– p. 11 Extensional Sets – examples

{i | φi is total } ?

{i | φi(i) ↓} ?

{i | φi(0) ↑} ?

{i | φi(0) < i} ?

– p. 11 Extensional Sets – examples

{i | φi is total } ?

{i | φi(i) ↓} ?

{i | φi(0) ↑} ?

{i | φi(0) < i} ?

{i | Dom(φi) is finite } ?

– p. 11 Rice’s Theorem

Theorem Let I = {i | Φi ∈ A} with A ⊆ Fc. I is recursive if and only if A = ∅ or A = Fc.

– p. 12 Rice’s Theorem

Theorem Let I = {i | Φi ∈ A} with A ⊆ Fc. I is recursive if and only if A = ∅ or A = Fc. Proof Let i ∈ I and j 6∈ I.

i if x 6∈ I f(x) = ( j otherwise

By the fixed point theorem

Φf(p) ≃ Φp

Two cases can arise: 1. f(p) = i and 2. f(p) = j.

– p. 12 Examples

– p. 13 Examples

{i | φi is total } ?

– p. 13 Examples

{i | φi is total } ?

{i | φi ≃ f} ?

– p. 13 Examples

{i | φi is total } ?

{i | φi ≃ f} ?

{i | φi(0) ↑} ?

– p. 13 Examples

{i | φi is total } ?

{i | φi ≃ f} ?

{i | φi(0) ↑} ?

{i | φi ↑} ?

– p. 13 Examples

{i | φi is total } ?

{i | φi ≃ f} ?

{i | φi(0) ↑} ?

{i | φi ↑} ?

{i | Dom(φi) is finite } ?

– p. 13 Examples

{i | φi is total } ?

{i | φi ≃ f} ?

{i | φi(0) ↑} ?

{i | φi ↑} ?

{i | Dom(φi) is finite } ?

{i | TMi(0) ↓ in 1 step } ?

– p. 13 Applicability direct undirect. Ex. {i | φi(0) ↑}

– p. 14 Example

Let Di = Dom(φi). Is the set

I = {i | Di ∩ Da = ∅}

(with Da =6 ∅) recursive or recursively enumerable?

– p. 15 Summary

One piece of good news: The computational models (Turing machines, λ-calculus, recursive functions ...) are equivalent And the rest, all bad: The is undecidable Most of everything is undecidable (Rice’s theorem)

– p. 16 Extending functions

Def. A function f extends g iff

∀xg(x) ↓⇒ g(x) = f(x)

– p. 17 Extending functions

Def. A function f extends g iff

∀xg(x) ↓⇒ g(x) = f(x)

Claim: Not all functions can be extended by total functions!

– p. 17 Interpreter vs Terminator

interpreter Φz(,x) ≃ Φl(x) terminator

1 if Φl(x) ↓ Φt(l,x) = ( 0 otherwise If a formalism calculates only total functions then there is no interpreter.

– p. 18 Undecidability of First-order Logic

SAT for formulas of propositional classical logic is NP-complete SAT for formulas of first-order classical logic is undecidable

– p. 19 Undecidability of First-order Logic

Proof by contradiction Assume we can solve our problem Show that this results in us being able to solve the Halting Problem too Conclude that we cannot solve the original problem

– p. 20 Reduction to the HP for FOL SAT

Assume we can decide φ ∈ SAT , for all FOL φ Given any TM machine M with input w We will determine if it halts or not Trick is to encode "do you halt" in first order logic. (multiple approaches possible)

– p. 21 Encoding formula (propositional case)

φw uses Boolean variables of three types.

q ∈ Q, −t(n) ≤ i ≤ t(n), j ∈ Σ, 0 ≤ k ≤ t(n)

Ti,j,k is true iff the i-th cell contains symbol j at step k of the computation

Hi,k is true iff M’s read/write head is at tape cell i at step k of the computation

Qq,k is true if M is in state q at step k of the computation.

The formula φw consists of four parts: φ φ φ φ w = unique(M) ∧ initial(w) ∧ accept(M) ∧

φcompute(M)

– p. 22 Details of the formula (cont.)

φ guarantees that the variables encode legal unique(M) configurations.

φstart(w) encodes the initial configuration of M on w.

φaccept(M) encodes the accepting configuration.

φcompute(M) encodes the transitions of the machine.

– p. 23 Encoding the formula (first-order case)

φw uses Boolean predicates of three types.

Tj(i, k) is true iff the i-th cell contains symbol j at step k of the computation H(i, k) is true iff M’s read/write head is at tape cell i at step k of the computation

Qq(k) is true if M is in state q at step k of the computation.

– p. 24 Encoding the formula (first-order case)

φw uses Boolean predicates of three types.

Tj(i, k) is true iff the i-th cell contains symbol j at step k of the computation H(i, k) is true iff M’s read/write head is at tape cell i at step k of the computation

Qq(k) is true if M is in state q at step k of the computation.

The formula φw consists of 5 parts: the "usual" φ φ φ kQ k unique(M) ∧ start(w) ∧ compute(M) ∧∃ qf ( )

plus some auxiliary conditions on the first-order encoding

– p. 24 Undecidability of First-order Logic

SAT is not recursive

– p. 25 Undecidability of First-order Logic

SAT is not recursive TAUT is semi-decidable

– p. 25 Undecidability of First-order Logic

SAT is not recursive TAUT is semi-decidable SAT = T AUT

– p. 25 Undecidability of First-order Logic

SAT is not recursive TAUT is semi-decidable SAT = T AUT SAT is not even semi-decidable (Post theorem)

– p. 25 Bibliography

Rogers, Theory of recursive functions and effective computability, 1967 Cutland, Computability Cambridge University Press, 2000 Odifreddi, Classical Recursion Theory, North-Holland, 1989 Brainerd, Landweber, Theory of Computation, John Wiley and Sons, 1974 Terwijn, Syllabus Computability Theory, available at http://www.math.ru.nl/~terwijn/ Boolos, Jeffrey, Computability and Logic

– p. 26