• Keine Ergebnisse gefunden

Theory of Computer Science D1. Turing-Computability Gabriele R¨oger

N/A
N/A
Protected

Academic year: 2022

Aktie "Theory of Computer Science D1. Turing-Computability Gabriele R¨oger"

Copied!
22
0
0

Wird geladen.... (Jetzt Volltext ansehen)

Volltext

(1)

D1. Turing-Computability

Gabriele R¨oger

University of Basel

April 8, 2019

(2)

Overview: Course

contents of this course:

A. backgroundX

. mathematical foundations and proof techniques B. logicX

. How can knowledge be represented?

. How can reasoning be automated?

C. automata theory and formal languagesX . What is a computation?

D. Turing computability

. What can be computed at all?

E. complexity theory

. What can be computed efficiently?

F. more computability theory . Other models of computability

(3)

Main Question

Main question in this part of the course:

What can be computed

by a computer?

(4)

Overview: Computability Theory

Computability

Turing-Computability

Undecidable Problems

(Semi-)Decidability Halting Problem

Reductions Rice’s Theorem Other Problems

(5)

Overview: Computability Theory

Computability

Turing-Computability

Undecidable Problems

(Semi-)Decidability Halting Problem

Reductions Rice’s Theorem Other Problems

(6)

Turing-Computable Functions

(7)

Computation

What is a computation?

intuitive model of computation(pen and paper) vs. computation on physical computers

vs. formal mathematical models In the following chapters we investigate

models of computationfor partial functions f :Nk0pN0. no real limitation: arbitrary information

can be encoded as numbers German: Berechnungsmodelle

(8)

Church-Turing Thesis

Church-Turing Thesis

All functions that can becomputed in the intuitive sense can be computed by aTuring machine.

German: Church-Turing-These cannot be proven (why not?)

but we will collect evidence for it ( part F)

(9)

Reminder: Deterministic Turing Machine (DTM)

Definition (Deterministic Turing Machine)

Adeterministic Turing machine(DTM) is given by a 7-tuple M =hQ,Σ,Γ, δ,q0,,Ei with:

Q finite, non-empty set of states Σ6=∅ finiteinput alphabet Γ⊃Σ finitetape alphabet

δ : (Q\E)×Γ→Q×Γ× {L,R,N} transition function q0∈Q start state

∈Γ\Σ blank symbol E ⊆Q end states

(10)

Reminder: Configurations and Computation Steps

How do Turing Machines Work?

configuration: hα,q, βi with α∈Γ,q ∈Q,β∈Γ+ one computation step: c `c0 if one computation step can turn configuration c into configuration c0

multiple computation steps: c `c0 if 0 or more computation steps can turn configurationc into configurationc0

(c =c0 `c1`c2 ` · · · `cn−1`cn=c0,n≥0) (Definition of`, i.e., how a computation step changes the configuration, is not repeated here. Chapter C7)

(11)

Questions

Questions?

(12)

Computation of Functions?

How can a DTM compute a function?

“Input” x is the initial tape content

“Output”f(x) is the tape content (ignoring blanks at the left and right) when reaching an end state If the TM does not stop for the given input, f(x) is undefined for this input.

Which kinds of functions can be computed this way?

directly, only functions on words: f : ΣpΣ interpretation as functions on numbersf :Nk0pN0: encode numbers as words

(13)

Turing Machines: Computed Function

Definition (Function Computed by a Turing Machine)

A DTMM =hQ,Σ,Γ, δ,q0,,Ei computesthe (partial) function f : ΣpΣ for which:

for all x,y ∈Σ: f(x) =y iff hε,q0,xi ` h. . .,qe,y. . .i withqe∈E. (special case: initial configuration hε,q0,i if x=ε) German: DTM berechnetf

What happens if symbols from Γ\Σ (e. g., ) occur iny?

What happens if the read-write head is not on the first symbol ofy at the end?

Is f uniquely defined by this definition? Why?

(14)

Turing-Computable Functions on Words

Definition (Turing-Computable,f : ΣpΣ)

A (partial) functionf : ΣpΣ is called Turing-computable if a DTM that computesf exists.

German: Turing-berechenbar

(15)

Example: Turing-Computable Functions on Words

Example

Let Σ ={a,b,#}.

The functionf : ΣpΣ with f(w) =w#w for all w ∈Σ is Turing-computable.

blackboard

(16)

Encoding Numbers as Words

Definition (Encoded Function)

Letf :Nk0pN0 be a (partial) function.

Theencoded functionfcode off is the partial function fcode: ΣpΣ with Σ ={0,1,#} andfcode(w) =w0 iff

there are n1, . . . ,nk,n0 ∈N0 such that f(n1, . . . ,nk) =n0,

w =bin(n1)#. . .#bin(nk) and w0 =bin(n0).

Herebin:N0 → {0,1} is the binary encoding (e. g.,bin(5) =101).

German: kodierte Funktion

Example: f(5,2,3) = 4 corresponds tofcode(101#10#11) =100.

(17)

Turing-Computable Numerical Functions

Definition (Turing-Computable,f :Nk0pN0)

A (partial) functionf :Nk0pN0 is called Turing-computable if a DTM that computesfcode exists.

German: Turing-berechenbar

(18)

Example: Turing-Computable Numerical Function

Example

The following numerical functions are Turing-computable:

succ:N0pN0 with succ(n) :=n+ 1 pred1:N0pN0 with pred1(n) :=

(n−1 ifn ≥1 0 ifn = 0 pred2:N0pN0 with pred2(n) :=

(n−1 ifn≥1 undefined ifn= 0 blackboard/exercises

(19)

More Turing-Computable Numerical Functions

Example

The following numerical functions are Turing-computable:

add:N20pN0 with add(n1,n2) :=n1+n2

sub:N20pN0 with sub(n1,n2) := max{n1−n2,0}

mul:N20pN0 with mul(n1,n2) :=n1·n2

div:N20pN0 with div(n1,n2) :=

(ln

1

n2

m

if n2 6= 0 undefined if n2 = 0 sketch?

(20)

Questions

Questions?

(21)

Summary

(22)

Summary

main question: what can a computer compute?

approach: investigate formal models of computation here: deterministic Turing machines

Turing-computablefunctionf : ΣpΣ:

there is a DTM that transforms every input w ∈Σ into the output f(w) (undefined if DTM does not stop or stops in invalid configuration)

Turing-computablefunctionf :Nk0pN0:

ditto; numbers encoded in binary and separated by #

Referenzen

ÄHNLICHE DOKUMENTE

Whenever M 0 is in one of the primed states, it does not change the tape, switches to the unprimed state q and moves left.. For every transition of M with neutral move, M 0 takes

The first tape always contains w , the second tape corresponds to the content of N’s tape on some branch of the computation tree and the third tape tracks the position in

C1.1 Hilbert’s 10th Problem C1.2 Church-Turing Thesis C1.3 Encoding?.

If you read a 1 at the first tape position, move every non-blank symbol on the tape one position to the right, write a 1 in the first tape position and accept...

I If you read a 1 at the first tape position, move every non-blank symbol on the tape one position to the right, write a 1 in the first tape position and accept...

All functions that can be computed in the intuitive sense can be computed by a Turing machine.

LOOP, WHILE and GOTO programs are structured like programs in (simple) “traditional” programming languages use finitely many variables from the set {x 0 , x 1 , x 2 ,.. } that can

show that there is a number k for every LOOP program such that the computed function value is smaller than a(k , n), if n is the largest input value. proof by structural induction;