<<

Introduction to Theory of Computability

Nikolaj Popov and Tudor Jebelean

Research Institute for Symbolic Computation, Linz

[email protected] Outline

Computability Preliminaries Primitive Recursive Functions Partial Functions of the Computable Functions

Decidability Decidable and Semidecidable Sets

The Halting Problem Outline

Computability Preliminaries Primitive Recursive Functions Partial Functions Enumeration of the Computable Functions

Decidability Decidable and Semidecidable Sets

The Halting Problem Introduction

Various notions of computation developed by Church, Turing and Kleene

The three computational models (, λ-calculus, and Turing machine) were shown to be equivalent (1934).

Church-Turing thesis Any real-world computation can be translated into an equivalent computation involving a Turing machine (or a program in any reasonable programming language).

The intuitive notion of effective computability for functions and algorithms is formally expressed by Turing machines or the lambda calculus.

A is computable, in the intuitive sense, if and only if it is Turing-computable. Introduction

Various notions of computation developed by Church, Turing and Kleene

The three computational models (recursion, λ-calculus, and Turing machine) were shown to be equivalent (1934).

Church-Turing thesis Any real-world computation can be translated into an equivalent computation involving a Turing machine (or a program in any reasonable programming language).

The intuitive notion of effective computability for functions and algorithms is formally expressed by Turing machines or the lambda calculus.

A function is computable, in the intuitive sense, if and only if it is Turing-computable. Introduction

Various notions of computation developed by Church, Turing and Kleene

The three computational models (recursion, λ-calculus, and Turing machine) were shown to be equivalent (1934).

Church-Turing thesis Any real-world computation can be translated into an equivalent computation involving a Turing machine (or a program in any reasonable programming language).

The intuitive notion of effective computability for functions and algorithms is formally expressed by Turing machines or the lambda calculus.

A function is computable, in the intuitive sense, if and only if it is Turing-computable. Introduction

Various notions of computation developed by Church, Turing and Kleene

The three computational models (recursion, λ-calculus, and Turing machine) were shown to be equivalent (1934).

Church-Turing thesis Any real-world computation can be translated into an equivalent computation involving a Turing machine (or a program in any reasonable programming language).

The intuitive notion of effective computability for functions and algorithms is formally expressed by Turing machines or the lambda calculus.

A function is computable, in the intuitive sense, if and only if it is Turing-computable. Introduction

Various notions of computation developed by Church, Turing and Kleene

The three computational models (recursion, λ-calculus, and Turing machine) were shown to be equivalent (1934).

Church-Turing thesis Any real-world computation can be translated into an equivalent computation involving a Turing machine (or a program in any reasonable programming language).

The intuitive notion of effective computability for functions and algorithms is formally expressed by Turing machines or the lambda calculus.

A function is computable, in the intuitive sense, if and only if it is Turing-computable. Preliminaries

Domain of a function Dom[f ] = {x | f [x] is defined}

Range of a function Ran[f ] = {y | ∃x ∈ Dom[f ] ∧ f [x] = y}

Graph of a function Graph[f ] = {hx, yi | x ∈ Dom[f ] ∧ f [x] = y}

Partial equality (∀x, y)(f [x] ' y ⇔ hx, yi ∈ Graph[f ]) Preliminaries

Domain of a function Dom[f ] = {x | f [x] is defined}

Range of a function Ran[f ] = {y | ∃x ∈ Dom[f ] ∧ f [x] = y}

Graph of a function Graph[f ] = {hx, yi | x ∈ Dom[f ] ∧ f [x] = y}

Partial equality (∀x, y)(f [x] ' y ⇔ hx, yi ∈ Graph[f ]) Preliminaries

Domain of a function Dom[f ] = {x | f [x] is defined}

Range of a function Ran[f ] = {y | ∃x ∈ Dom[f ] ∧ f [x] = y}

Graph of a function Graph[f ] = {hx, yi | x ∈ Dom[f ] ∧ f [x] = y}

Partial equality (∀x, y)(f [x] ' y ⇔ hx, yi ∈ Graph[f ]) Preliminaries

Domain of a function Dom[f ] = {x | f [x] is defined}

Range of a function Ran[f ] = {y | ∃x ∈ Dom[f ] ∧ f [x] = y}

Graph of a function Graph[f ] = {hx, yi | x ∈ Dom[f ] ∧ f [x] = y}

Partial equality (∀x, y)(f [x] ' y ⇔ hx, yi ∈ Graph[f ]) Preliminaries

f is defined on x f [x] ↓ ⇔ ∃y (x, y) ∈ Graph[f ]

Partial equality ' (∀x)(f [x] ' g[x]) iff (∀x)(f [x] ↓ ⇔ g[x] ↓) (∀x)(f [x] ↓ ⇒ f [x] = g[x])

f is computable f is iff there exists a program P which computes it Preliminaries

f is defined on x f [x] ↓ ⇔ ∃y (x, y) ∈ Graph[f ]

Partial equality ' (∀x)(f [x] ' g[x]) iff (∀x)(f [x] ↓ ⇔ g[x] ↓) (∀x)(f [x] ↓ ⇒ f [x] = g[x])

f is computable f is computable function iff there exists a program P which computes it Preliminaries

f is defined on x f [x] ↓ ⇔ ∃y (x, y) ∈ Graph[f ]

Partial equality ' (∀x)(f [x] ' g[x]) iff (∀x)(f [x] ↓ ⇔ g[x] ↓) (∀x)(f [x] ↓ ⇒ f [x] = g[x])

f is computable f is computable function iff there exists a program P which computes it Superposition

h is a superposition of f , g1,..., gk h[x] ' f [g1[x],..., gk [x]]

Theorem Given the computable functions f , g1,..., gk , then h[x] ' f [g1[x],..., gk [x]] is computable function.

Superposition preserves computability. Superposition

h is a superposition of f , g1,..., gk h[x] ' f [g1[x],..., gk [x]]

Theorem Given the computable functions f , g1,..., gk , then h[x] ' f [g1[x],..., gk [x]] is computable function.

Superposition preserves computability. Superposition

h is a superposition of f , g1,..., gk h[x] ' f [g1[x],..., gk [x]]

Theorem Given the computable functions f , g1,..., gk , then h[x] ' f [g1[x],..., gk [x]] is computable function.

Superposition preserves computability. Primitive Recursion

h is obtained by weak primitive recursion from g and a

 a ⇐ x = 0 h[x] ' g[x, h[x − 1]] ⇐ o.w.

h is obtained by primitive recursion from f and g

 f [x] ⇐ y = 0 h[x, y] ' g[x, y, h[x, y − 1]] ⇐ o.w.

Primitive recursion preserves computability. Primitive Recursion

h is obtained by weak primitive recursion from g and a

 a ⇐ x = 0 h[x] ' g[x, h[x − 1]] ⇐ o.w.

h is obtained by primitive recursion from f and g

 f [x] ⇐ y = 0 h[x, y] ' g[x, y, h[x, y − 1]] ⇐ o.w.

Primitive recursion preserves computability. Primitive Recursion

h is obtained by weak primitive recursion from g and a

 a ⇐ x = 0 h[x] ' g[x, h[x − 1]] ⇐ o.w.

h is obtained by primitive recursion from f and g

 f [x] ⇐ y = 0 h[x, y] ' g[x, y, h[x, y − 1]] ⇐ o.w.

Primitive recursion preserves computability. Primitive Recursive Functions

The basic functions are primitive recursive O[x] ' 0 S[x] ' x + 1 n Ii [x] ' xi

The superposition is primitive recursive

If f , g1,..., gk are primitive recursive, then h[x] ' f [g1[x],..., gk [x]] is primitive recursive.

The primitive recursion is primitive recursive If f and g are primitive recursive, then

 f [x] ⇐ y = 0 h[x, y] ' g[x, y, h[x, y − 1]] ⇐ o.w. is primitive recursive. Primitive Recursive Functions

The basic functions are primitive recursive O[x] ' 0 S[x] ' x + 1 n Ii [x] ' xi

The superposition is primitive recursive

If f , g1,..., gk are primitive recursive, then h[x] ' f [g1[x],..., gk [x]] is primitive recursive.

The primitive recursion is primitive recursive If f and g are primitive recursive, then

 f [x] ⇐ y = 0 h[x, y] ' g[x, y, h[x, y − 1]] ⇐ o.w. is primitive recursive. Primitive Recursive Functions

The basic functions are primitive recursive O[x] ' 0 S[x] ' x + 1 n Ii [x] ' xi

The superposition is primitive recursive

If f , g1,..., gk are primitive recursive, then h[x] ' f [g1[x],..., gk [x]] is primitive recursive.

The primitive recursion is primitive recursive If f and g are primitive recursive, then

 f [x] ⇐ y = 0 h[x, y] ' g[x, y, h[x, y − 1]] ⇐ o.w. is primitive recursive. Primitive Recursion

Theorem All the primitive recursive functions are computable.

Theorem All the primitive recursive functions are total. Primitive Recursion

Theorem All the primitive recursive functions are computable.

Theorem All the primitive recursive functions are total. Examples

Addition is primitive recursive

f1[x, y] ' x + y

 x ⇐ y = 0 f1[x, y] ' S[f1[x, y − 1]] ⇐ o.w.

Multiplication is primitive recursive

f2[x, y] ' x.y

 0 ⇐ y = 0 f2[x, y] ' x + f2[x, y − 1] ⇐ o.w. Examples

Addition is primitive recursive

f1[x, y] ' x + y

 x ⇐ y = 0 f1[x, y] ' S[f1[x, y − 1]] ⇐ o.w.

Multiplication is primitive recursive

f2[x, y] ' x.y

 0 ⇐ y = 0 f2[x, y] ' x + f2[x, y − 1] ⇐ o.w. Examples

Addition is primitive recursive

f1[x, y] ' x + y

 x ⇐ y = 0 f1[x, y] ' S[f1[x, y − 1]] ⇐ o.w.

Multiplication is primitive recursive

f2[x, y] ' x.y

 0 ⇐ y = 0 f2[x, y] ' x + f2[x, y − 1] ⇐ o.w. Examples

Addition is primitive recursive

f1[x, y] ' x + y

 x ⇐ y = 0 f1[x, y] ' S[f1[x, y − 1]] ⇐ o.w.

Multiplication is primitive recursive

f2[x, y] ' x.y

 0 ⇐ y = 0 f2[x, y] ' x + f2[x, y − 1] ⇐ o.w. Examples

Power is primitive recursive y f3[x, y] ' x

 1 ⇐ y = 0 f3[x, y] ' x.f3[x, y − 1]] ⇐ o.w.

Subtraction-dot-one is primitive recursive

 0 ⇐ x = 0 f [x] ' x−˙ 1 ' 4 x − 1 ⇐ o.w.

 0 ⇐ x = 0 f4[x] ' f4[x − 1] + 1 ⇐ o.w. Examples

Power is primitive recursive y f3[x, y] ' x

 1 ⇐ y = 0 f3[x, y] ' x.f3[x, y − 1]] ⇐ o.w.

Subtraction-dot-one is primitive recursive

 0 ⇐ x = 0 f [x] ' x−˙ 1 ' 4 x − 1 ⇐ o.w.

 0 ⇐ x = 0 f4[x] ' f4[x − 1] + 1 ⇐ o.w. Examples

Power is primitive recursive y f3[x, y] ' x

 1 ⇐ y = 0 f3[x, y] ' x.f3[x, y − 1]] ⇐ o.w.

Subtraction-dot-one is primitive recursive

 0 ⇐ x = 0 f [x] ' x−˙ 1 ' 4 x − 1 ⇐ o.w.

 0 ⇐ x = 0 f4[x] ' f4[x − 1] + 1 ⇐ o.w. Examples

Power is primitive recursive y f3[x, y] ' x

 1 ⇐ y = 0 f3[x, y] ' x.f3[x, y − 1]] ⇐ o.w.

Subtraction-dot-one is primitive recursive

 0 ⇐ x = 0 f [x] ' x−˙ 1 ' 4 x − 1 ⇐ o.w.

 0 ⇐ x = 0 f4[x] ' f4[x − 1] + 1 ⇐ o.w. Examples

Subtraction-dot is primitive recursive

 0 ⇐ x < y f [x, y] ' x−˙ y ' 5 x − y ⇐ o.w.

 x ⇐ y = 0 f5[x, y] ' f5[x, y − 1]−˙ 1 ⇐ o.w.

Factorial is primitive recursive

f6[x] ' x!

 1 ⇐ x = 0 f6[x] ' x.f6[x − 1]] ⇐ o.w. Examples

Subtraction-dot is primitive recursive

 0 ⇐ x < y f [x, y] ' x−˙ y ' 5 x − y ⇐ o.w.

 x ⇐ y = 0 f5[x, y] ' f5[x, y − 1]−˙ 1 ⇐ o.w.

Factorial is primitive recursive

f6[x] ' x!

 1 ⇐ x = 0 f6[x] ' x.f6[x − 1]] ⇐ o.w. Examples

Subtraction-dot is primitive recursive

 0 ⇐ x < y f [x, y] ' x−˙ y ' 5 x − y ⇐ o.w.

 x ⇐ y = 0 f5[x, y] ' f5[x, y − 1]−˙ 1 ⇐ o.w.

Factorial is primitive recursive

f6[x] ' x!

 1 ⇐ x = 0 f6[x] ' x.f6[x − 1]] ⇐ o.w. Examples

Subtraction-dot is primitive recursive

 0 ⇐ x < y f [x, y] ' x−˙ y ' 5 x − y ⇐ o.w.

 x ⇐ y = 0 f5[x, y] ' f5[x, y − 1]−˙ 1 ⇐ o.w.

Factorial is primitive recursive

f6[x] ' x!

 1 ⇐ x = 0 f6[x] ' x.f6[x − 1]] ⇐ o.w. Examples Sign is primitive recursive

 0 ⇐ x = 0 sg[x] ' 1 ⇐ o.w.

 0 ⇐ x = 0 sg[x] ' O[sg[x − 1]] + 1 ⇐ o.w.

Opposite-sign is primitive recursive

 1 ⇐ x = 0 sg[x] ' 0 ⇐ o.w.

 1 ⇐ x = 0 sg[x] ' O[sg[x − 1]] ⇐ o.w. Examples Sign is primitive recursive

 0 ⇐ x = 0 sg[x] ' 1 ⇐ o.w.

 0 ⇐ x = 0 sg[x] ' O[sg[x − 1]] + 1 ⇐ o.w.

Opposite-sign is primitive recursive

 1 ⇐ x = 0 sg[x] ' 0 ⇐ o.w.

 1 ⇐ x = 0 sg[x] ' O[sg[x − 1]] ⇐ o.w. Examples Sign is primitive recursive

 0 ⇐ x = 0 sg[x] ' 1 ⇐ o.w.

 0 ⇐ x = 0 sg[x] ' O[sg[x − 1]] + 1 ⇐ o.w.

Opposite-sign is primitive recursive

 1 ⇐ x = 0 sg[x] ' 0 ⇐ o.w.

 1 ⇐ x = 0 sg[x] ' O[sg[x − 1]] ⇐ o.w. Examples Sign is primitive recursive

 0 ⇐ x = 0 sg[x] ' 1 ⇐ o.w.

 0 ⇐ x = 0 sg[x] ' O[sg[x − 1]] + 1 ⇐ o.w.

Opposite-sign is primitive recursive

 1 ⇐ x = 0 sg[x] ' 0 ⇐ o.w.

 1 ⇐ x = 0 sg[x] ' O[sg[x − 1]] ⇐ o.w. Examples

Absolute value is primitive recursive mod[x, y] ' |x − y|

mod[x, y] ' (x−˙ y) + (y−˙ x)

Minimum is primitive recursive min[x, y]

min[x, y] ' x−˙ (x−˙ y)

Maximum is primitive recursive max[x, y]

max[x, y] ' x + (y−˙ x) Examples

Absolute value is primitive recursive mod[x, y] ' |x − y|

mod[x, y] ' (x−˙ y) + (y−˙ x)

Minimum is primitive recursive min[x, y]

min[x, y] ' x−˙ (x−˙ y)

Maximum is primitive recursive max[x, y]

max[x, y] ' x + (y−˙ x) Examples

Absolute value is primitive recursive mod[x, y] ' |x − y|

mod[x, y] ' (x−˙ y) + (y−˙ x)

Minimum is primitive recursive min[x, y]

min[x, y] ' x−˙ (x−˙ y)

Maximum is primitive recursive max[x, y]

max[x, y] ' x + (y−˙ x) Examples

Absolute value is primitive recursive mod[x, y] ' |x − y|

mod[x, y] ' (x−˙ y) + (y−˙ x)

Minimum is primitive recursive min[x, y]

min[x, y] ' x−˙ (x−˙ y)

Maximum is primitive recursive max[x, y]

max[x, y] ' x + (y−˙ x) Examples

Absolute value is primitive recursive mod[x, y] ' |x − y|

mod[x, y] ' (x−˙ y) + (y−˙ x)

Minimum is primitive recursive min[x, y]

min[x, y] ' x−˙ (x−˙ y)

Maximum is primitive recursive max[x, y]

max[x, y] ' x + (y−˙ x) Examples

Absolute value is primitive recursive mod[x, y] ' |x − y|

mod[x, y] ' (x−˙ y) + (y−˙ x)

Minimum is primitive recursive min[x, y]

min[x, y] ' x−˙ (x−˙ y)

Maximum is primitive recursive max[x, y]

max[x, y] ' x + (y−˙ x) Primitive recursion. Properties

Theorem If then else Let f0, f1, g be primitive recursive. Then  f [x] ⇐ g[x] = 0 h[x] ' 0 f1[x] ⇐ o.w. is primitive recursive.

proof:

h[x] ' sg[g[x]].f0[x] + sg[g[x]].f1[x] Primitive recursion. Properties

Theorem If then else Let f0, f1, g be primitive recursive. Then  f [x] ⇐ g[x] = 0 h[x] ' 0 f1[x] ⇐ o.w. is primitive recursive.

proof:

h[x] ' sg[g[x]].f0[x] + sg[g[x]].f1[x] Primitive recursion. Properties

Theorem If then1 ... thenk else Let f0,..., fk , g0,..., gk−1 be primitive recursive. Then   f0[x] ⇐ g0[x] = 0   f1[x] ⇐ g0[x] 6= 0 ∧ g1[x] = 0 h[x] ' ...  ...   fk [x] ⇐ o.w. is primitive recursive. Partial Functions

While loop input[x] y := 0 while f [x, y] > 0 do y := y + 1 return[y]

g is obtained by minimization from f g[x] ' y iff ∀z < y(f [x, z] ↓ ∧ f [x, z] > 0) f [x, y] ' 0

g is obtained by minimization from f g[x] ' µy[f [x, y] = 0] Partial Functions

While loop input[x] y := 0 while f [x, y] > 0 do y := y + 1 return[y]

g is obtained by minimization from f g[x] ' y iff ∀z < y(f [x, z] ↓ ∧ f [x, z] > 0) f [x, y] ' 0

g is obtained by minimization from f g[x] ' µy[f [x, y] = 0] Partial Functions

While loop input[x] y := 0 while f [x, y] > 0 do y := y + 1 return[y]

g is obtained by minimization from f g[x] ' y iff ∀z < y(f [x, z] ↓ ∧ f [x, z] > 0) f [x, y] ' 0

g is obtained by minimization from f g[x] ' µy[f [x, y] = 0] Partial Functions

The basic functions are partial O[x] ' 0 S[x] ' x + 1 n Ii [x] ' xi

The superposition is partial

If f , g1,..., gk are partial, then

h[x] ' f [g1[x],..., gk [x]] is partial. Partial Functions

The basic functions are partial O[x] ' 0 S[x] ' x + 1 n Ii [x] ' xi

The superposition is partial

If f , g1,..., gk are partial, then

h[x] ' f [g1[x],..., gk [x]] is partial. Partial Functions

The primitive recursion is partial If f and g are partial, then

 f [x] ⇐ y = 0 h[x, y] ' g[x, y, h[x, y − 1]] ⇐ o.w. is partial.

The minimization is partial If f is partial, then g[x] ' µy[f [x, y] = 0] is partial. Partial Functions

The primitive recursion is partial If f and g are partial, then

 f [x] ⇐ y = 0 h[x, y] ' g[x, y, h[x, y − 1]] ⇐ o.w. is partial.

The minimization is partial If f is partial, then g[x] ' µy[f [x, y] = 0] is partial. Partial Functions

Theorem All the partial functions are computable.

Alternative Definition Partial functions = Computable functions. Partial Functions

Theorem All the partial functions are computable.

Alternative Definition Partial functions = Computable functions. Examples

Subtraction is partial

 x − y ⇐ x ≥ y f [x, y] ' ↑ ⇐ o.w.

f [x, y] ' µz[z + y = x]

Division is partial

 x/y ⇐ ∃k(y.k = x) g[x, y] ' ↑ ⇐ o.w.

g[x, y] ' µk[k.y = x] Examples

Subtraction is partial

 x − y ⇐ x ≥ y f [x, y] ' ↑ ⇐ o.w.

f [x, y] ' µz[z + y = x]

Division is partial

 x/y ⇐ ∃k(y.k = x) g[x, y] ' ↑ ⇐ o.w.

g[x, y] ' µk[k.y = x] Examples

Subtraction is partial

 x − y ⇐ x ≥ y f [x, y] ' ↑ ⇐ o.w.

f [x, y] ' µz[z + y = x]

Division is partial

 x/y ⇐ ∃k(y.k = x) g[x, y] ' ↑ ⇐ o.w.

g[x, y] ' µk[k.y = x] Examples

Subtraction is partial

 x − y ⇐ x ≥ y f [x, y] ' ↑ ⇐ o.w.

f [x, y] ' µz[z + y = x]

Division is partial

 x/y ⇐ ∃k(y.k = x) g[x, y] ' ↑ ⇐ o.w.

g[x, y] ' µk[k.y = x] Enumeration of the computable functions

Enumeration = Encoding = Effective coding

I Uniqueness: each object has a unique code

I Totality: each natural number is a code of an object

I Effectiveness: For each object one can find algorithmically its code and for each code (number) one can find its object. Enumeration of the computable functions

I Let P0, P1,..., Pn,... be a list of all the programs (on one variable), and 0, 1,..., n,... be an effective coding of these programs.

I Each program Pn corresponds to a computable function ϕ

I Let ϕ0, ϕ1, . . . , ϕn,... be a list of all the computable functions (on one variable), and 0, 1,..., n,... be the effective encoding of these functions. The encoding of the functions is such that for any n, the program Pn is an implementation of the computable function ϕn. Enumeration of the computable functions

I Let P0, P1,..., Pn,... be a list of all the programs (on one variable), and 0, 1,..., n,... be an effective coding of these programs.

I Each program Pn corresponds to a computable function ϕ

I Let ϕ0, ϕ1, . . . , ϕn,... be a list of all the computable functions (on one variable), and 0, 1,..., n,... be the effective encoding of these functions. The encoding of the functions is such that for any n, the program Pn is an implementation of the computable function ϕn. Enumeration of the computable functions

I Let P0, P1,..., Pn,... be a list of all the programs (on one variable), and 0, 1,..., n,... be an effective coding of these programs.

I Each program Pn corresponds to a computable function ϕ

I Let ϕ0, ϕ1, . . . , ϕn,... be a list of all the computable functions (on one variable), and 0, 1,..., n,... be the effective encoding of these functions. The encoding of the functions is such that for any n, the program Pn is an implementation of the computable function ϕn. Example

Total function which is not computable

 ϕ [x] + 1 ⇐ ϕ [x] ↓ f [x] ' x x 0 ⇐ o.w.

Assume f is computable. Then f = ϕa for some a. If a ∈ Dom[ϕa] then ϕa[a] ↓. Hence, f [a] = ϕa[a] = ϕa[a] + 1 If a 6∈ Dom[ϕa] then ϕa[a] ↑. Hence, f [a] = ϕa[a] = 0, but ϕa[a] ↑ Example

Total function which is not computable

 ϕ [x] + 1 ⇐ ϕ [x] ↓ f [x] ' x x 0 ⇐ o.w.

Assume f is computable. Then f = ϕa for some a. If a ∈ Dom[ϕa] then ϕa[a] ↓. Hence, f [a] = ϕa[a] = ϕa[a] + 1 If a 6∈ Dom[ϕa] then ϕa[a] ↑. Hence, f [a] = ϕa[a] = 0, but ϕa[a] ↑ Kleene’s S-m-n Theorem

S-m-n Theorem m For any n, m exists a primitive recursive function Sn , such that for any a, x, y (m+n) (n) ϕa [x, y] ' ϕ m [y] Sn [a,x]

Property Let F be a computable function. Then there exists a number e, such that,

F[e, x] ' ϕe[x] Kleene’s S-m-n Theorem

S-m-n Theorem m For any n, m exists a primitive recursive function Sn , such that for any a, x, y (m+n) (n) ϕa [x, y] ' ϕ m [y] Sn [a,x]

Property Let F be a computable function. Then there exists a number e, such that,

F[e, x] ' ϕe[x] Kleene’s S-m-n Theorem

Property – Quines There exists a number e, such that,

e ' ϕe[x]

Quine in Lisp ((lambda (x)(list x (list 0quote x))) 0(lambda (x)(list x (list 0quote x)))) Kleene’s S-m-n Theorem

Property – Quines There exists a number e, such that,

e ' ϕe[x]

Quine in Lisp ((lambda (x)(list x (list 0quote x))) 0(lambda (x)(list x (list 0quote x)))) Universal Function Universal Function Theorem The universal function (n) Φn[a, x] ' ϕa [x] is computable.

Property The of all the total functions on n-variables does not have a computable universal function.

proof Assume Φ[a, x] is an universal function for the class of all the total functions on one variable. Let ϕ[x] ' Φ[x, x] + 1. Since Φ is total, ϕ is also total and hence, there exists a, such that ϕ[x] ' Φ[a, x]. ϕ[a] ' Φ[a, a], and also ϕ[a] ' Φ[a, a] + 1. Universal Function Universal Function Theorem The universal function (n) Φn[a, x] ' ϕa [x] is computable.

Property The class of all the total functions on n-variables does not have a computable universal function.

proof Assume Φ[a, x] is an universal function for the class of all the total functions on one variable. Let ϕ[x] ' Φ[x, x] + 1. Since Φ is total, ϕ is also total and hence, there exists a, such that ϕ[x] ' Φ[a, x]. ϕ[a] ' Φ[a, a], and also ϕ[a] ' Φ[a, a] + 1. Universal Function Universal Function Theorem The universal function (n) Φn[a, x] ' ϕa [x] is computable.

Property The class of all the total functions on n-variables does not have a computable universal function.

proof Assume Φ[a, x] is an universal function for the class of all the total functions on one variable. Let ϕ[x] ' Φ[x, x] + 1. Since Φ is total, ϕ is also total and hence, there exists a, such that ϕ[x] ' Φ[a, x]. ϕ[a] ' Φ[a, a], and also ϕ[a] ' Φ[a, a] + 1. Universal Function Universal Function Theorem The universal function (n) Φn[a, x] ' ϕa [x] is computable.

Property The class of all the total functions on n-variables does not have a computable universal function.

proof Assume Φ[a, x] is an universal function for the class of all the total functions on one variable. Let ϕ[x] ' Φ[x, x] + 1. Since Φ is total, ϕ is also total and hence, there exists a, such that ϕ[x] ' Φ[a, x]. ϕ[a] ' Φ[a, a], and also ϕ[a] ' Φ[a, a] + 1. Outline

Computability Preliminaries Primitive Recursive Functions Partial Functions Enumeration of the Computable Functions

Decidability Decidable and Semidecidable Sets

The Halting Problem Decidable and Semidecidable Sets A ⊆ Nn

Characteristic function of a χA

 1 ⇐ x ∈ A χ [x] ' A 0 ⇐ o.w.

Decidable Set A set A is decidable iff χA is computable. Decidable and Semidecidable Sets A ⊆ Nn

Characteristic function of a set χA

 1 ⇐ x ∈ A χ [x] ' A 0 ⇐ o.w.

Decidable Set A set A is decidable iff χA is computable. Decidable and Semidecidable Sets A ⊆ Nn

Characteristic function of a set χA

 1 ⇐ x ∈ A χ [x] ' A 0 ⇐ o.w.

Decidable Set A set A is decidable iff χA is computable. Decidable and Semidecidable Sets A ⊆ Nn

Semicharacteristic function of a set CA

 1 ⇐ x ∈ A C [x] ' A ↑ ⇐ o.w.

Semidecidable Set A set A is semidecidable iff CA is computable. Decidable and Semidecidable Sets A ⊆ Nn

Semicharacteristic function of a set CA

 1 ⇐ x ∈ A C [x] ' A ↑ ⇐ o.w.

Semidecidable Set A set A is semidecidable iff CA is computable. Decidable and Semidecidable Sets A ⊆ Nn

Theorem If A is decidable then it is also semidecidable.

Theorem If A is decidable then A is also decidable.

Theorem If A and B are decidable then A ∪ B, A ∩ B and A\B are decidable.

Theorem If A and B are semidecidable then A ∪ B and A ∩ B are semidecidable. Decidable and Semidecidable Sets A ⊆ Nn

Theorem If A is decidable then it is also semidecidable.

Theorem If A is decidable then A is also decidable.

Theorem If A and B are decidable then A ∪ B, A ∩ B and A\B are decidable.

Theorem If A and B are semidecidable then A ∪ B and A ∩ B are semidecidable. Decidable and Semidecidable Sets A ⊆ Nn

Theorem If A is decidable then it is also semidecidable.

Theorem If A is decidable then A is also decidable.

Theorem If A and B are decidable then A ∪ B, A ∩ B and A\B are decidable.

Theorem If A and B are semidecidable then A ∪ B and A ∩ B are semidecidable. Decidable and Semidecidable Sets A ⊆ Nn

Theorem If A is decidable then it is also semidecidable.

Theorem If A is decidable then A is also decidable.

Theorem If A and B are decidable then A ∪ B, A ∩ B and A\B are decidable.

Theorem If A and B are semidecidable then A ∪ B and A ∩ B are semidecidable. Decidable and Semidecidable Sets A ⊆ Nn

Theorem A set A is semidecidable iff there exists a computable function ϕ, such that, A = Dom[ϕ]

Post Theorem A set A is decidable iff A and A are semidecidable.

Kleene Set K The set K = {x | ϕx [x] ↓} is called Kleene set. Theorem K is semidecidable but not decidable. Decidable and Semidecidable Sets A ⊆ Nn

Theorem A set A is semidecidable iff there exists a computable function ϕ, such that, A = Dom[ϕ]

Post Theorem A set A is decidable iff A and A are semidecidable.

Kleene Set K The set K = {x | ϕx [x] ↓} is called Kleene set. Theorem K is semidecidable but not decidable. Decidable and Semidecidable Sets A ⊆ Nn

Theorem A set A is semidecidable iff there exists a computable function ϕ, such that, A = Dom[ϕ]

Post Theorem A set A is decidable iff A and A are semidecidable.

Kleene Set K The set K = {x | ϕx [x] ↓} is called Kleene set. Theorem K is semidecidable but not decidable. Decidable and Semidecidable Sets A ⊆ Nn

Theorem A set A is semidecidable iff there exists a computable function ϕ, such that, A = Dom[ϕ]

Post Theorem A set A is decidable iff A and A are semidecidable.

Kleene Set K The set K = {x | ϕx [x] ↓} is called Kleene set. Theorem K is semidecidable but not decidable. Outline

Computability Preliminaries Primitive Recursive Functions Partial Functions Enumeration of the Computable Functions

Decidability Decidable and Semidecidable Sets

The Halting Problem The Halting Problem

The halting problem is a decision problem which can be stated as follows:

Given a source code of a program, decide whether the program terminates or will run forever.

This is equivalent to the problem of deciding, given a program and an input, whether the program will eventually halt when executed on that input, or will run forever. The Halting Problem

The halting problem is a decision problem which can be stated as follows:

Given a source code of a program, decide whether the program terminates or will run forever.

This is equivalent to the problem of deciding, given a program and an input, whether the program will eventually halt when executed on that input, or will run forever. The Halting Problem

Assume there is a program P (a computable function) with the following property:  1 ⇐ Q[x] ↓ P[Q, x] ' 0 ⇐ o.w.

 1 ⇐ ϕ [x] ↓ P[a, x] ' a 0 ⇐ o.w.

a ∈ K ⇔ ϕa[a] ↓ ⇔ P[a, a] = 1

a ∈ K ⇔ ϕa[a] ↑ ⇔ P[a, a] = 0

Thus K is decidable. This is a contradiction! Therefore, the Halting problem is not decidable – it is undecidable. The Halting Problem

Assume there is a program P (a computable function) with the following property:  1 ⇐ Q[x] ↓ P[Q, x] ' 0 ⇐ o.w.

 1 ⇐ ϕ [x] ↓ P[a, x] ' a 0 ⇐ o.w.

a ∈ K ⇔ ϕa[a] ↓ ⇔ P[a, a] = 1

a ∈ K ⇔ ϕa[a] ↑ ⇔ P[a, a] = 0

Thus K is decidable. This is a contradiction! Therefore, the Halting problem is not decidable – it is undecidable. The Halting Problem

Assume there is a program P (a computable function) with the following property:  1 ⇐ Q[x] ↓ P[Q, x] ' 0 ⇐ o.w.

 1 ⇐ ϕ [x] ↓ P[a, x] ' a 0 ⇐ o.w.

a ∈ K ⇔ ϕa[a] ↓ ⇔ P[a, a] = 1

a ∈ K ⇔ ϕa[a] ↑ ⇔ P[a, a] = 0

Thus K is decidable. This is a contradiction! Therefore, the Halting problem is not decidable – it is undecidable. The Halting Problem

Assume there is a program P (a computable function) with the following property:  1 ⇐ Q[x] ↓ P[Q, x] ' 0 ⇐ o.w.

 1 ⇐ ϕ [x] ↓ P[a, x] ' a 0 ⇐ o.w.

a ∈ K ⇔ ϕa[a] ↓ ⇔ P[a, a] = 1

a ∈ K ⇔ ϕa[a] ↑ ⇔ P[a, a] = 0

Thus K is decidable. This is a contradiction! Therefore, the Halting problem is not decidable – it is undecidable. Questionnaire

When is a function computable?

When is a problem decidable?

When is a problem semidecidable?

When is a problem undecidable? Questionnaire

When is a function computable?

When is a problem decidable?

When is a problem semidecidable?

When is a problem undecidable? Questionnaire

When is a function computable?

When is a problem decidable?

When is a problem semidecidable?

When is a problem undecidable? Questionnaire

When is a function computable?

When is a problem decidable?

When is a problem semidecidable?

When is a problem undecidable? Questionnaire

Factorial

 1 ⇐ x = 0 fact[x] ' x.fact[x − 1] ⇐ o.w.

Sum

 0 ⇐ x = 0 sum[x] ' x + sum[x − 1] ⇐ o.w.

Is fact[0] ' sum[0]?

Is fact[2] ' sum[2]?

Is fact[−2] ' fact[−5]? Questionnaire

Factorial

 1 ⇐ x = 0 fact[x] ' x.fact[x − 1] ⇐ o.w.

Sum

 0 ⇐ x = 0 sum[x] ' x + sum[x − 1] ⇐ o.w.

Is fact[0] ' sum[0]?

Is fact[2] ' sum[2]?

Is fact[−2] ' fact[−5]? Questionnaire

Factorial

 1 ⇐ x = 0 fact[x] ' x.fact[x − 1] ⇐ o.w.

Sum

 0 ⇐ x = 0 sum[x] ' x + sum[x − 1] ⇐ o.w.

Is fact[0] ' sum[0]?

Is fact[2] ' sum[2]?

Is fact[−2] ' fact[−5]? Questionnaire

Factorial

 1 ⇐ x = 0 fact[x] ' x.fact[x − 1] ⇐ o.w.

Sum

 0 ⇐ x = 0 sum[x] ' x + sum[x − 1] ⇐ o.w.

Is fact[0] ' sum[0]?

Is fact[2] ' sum[2]?

Is fact[−2] ' fact[−5]? Questionnaire

Problem P: The function fact is defined on x.

Is the problem P decidable?

Problem Q: An arbitrary function f is defined on x.

Is the problem Q decidable? Questionnaire

Problem P: The function fact is defined on x.

Is the problem P decidable?

Problem Q: An arbitrary function f is defined on x.

Is the problem Q decidable? Questionnaire

Problem P: The function fact is defined on x.

Is the problem P decidable?

Problem Q: An arbitrary function f is defined on x.

Is the problem Q decidable? Questionnaire

Problem P: The function fact is defined on x.

Is the problem P decidable?

Problem Q: An arbitrary function f is defined on x.

Is the problem Q decidable? Questionnaire

How many indexes are there for the factorial function?

How many indexes are there for the universal function for the class of all the total functions?

How many indexes are there for the universal function for the class of all the partial recursive functions? Questionnaire

How many indexes are there for the factorial function?

How many indexes are there for the universal function for the class of all the total functions?

How many indexes are there for the universal function for the class of all the partial recursive functions? Questionnaire

How many indexes are there for the factorial function?

How many indexes are there for the universal function for the class of all the total functions?

How many indexes are there for the universal function for the class of all the partial recursive functions?