• Keine Ergebnisse gefunden

Theory of Computer Science

N/A
N/A
Protected

Academic year: 2022

Aktie "Theory of Computer Science"

Copied!
6
0
0

Wird geladen.... (Jetzt Volltext ansehen)

Volltext

(1)

Theory of Computer Science

D1. Turing-Computability

Gabriele R¨ oger

University of Basel

April 8, 2019

Gabriele R¨oger (University of Basel) Theory of Computer Science April 8, 2019 1 / 21

Theory of Computer Science

April 8, 2019 — D1. Turing-Computability

D1.1 Turing-Computable Functions

D1.2 Summary

Gabriele R¨oger (University of Basel) Theory of Computer Science April 8, 2019 2 / 21

Overview: Course

contents of this course:

A. background X

. mathematical foundations and proof techniques B. logic X

. How can knowledge be represented?

. How can reasoning be automated?

C. automata theory and formal languages X . 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

Main Question

Main question in this part of the course:

What can be computed

by a computer?

(2)

Overview: Computability Theory

Computability

Turing-Computability

Undecidable Problems

(Semi-)Decidability Halting Problem

Reductions Rice’s Theorem Other Problems

Gabriele R¨oger (University of Basel) Theory of Computer Science April 8, 2019 5 / 21

Overview: Computability Theory

Computability

Turing-Computability

Undecidable Problems

(Semi-)Decidability Halting Problem

Reductions Rice’s Theorem Other Problems

Gabriele R¨oger (University of Basel) Theory of Computer Science April 8, 2019 6 / 21

D1. Turing-Computability Turing-Computable Functions

D1.1 Turing-Computable Functions

D1. Turing-Computability Turing-Computable Functions

Computation

What is a computation?

I intuitive model of computation (pen and paper)

I vs. computation on physical computers

I vs. formal mathematical models

In the following chapters we investigate

models of computation for partial functions f : N k 0p N 0 .

I no real limitation: arbitrary information can be encoded as numbers

German: Berechnungsmodelle

(3)

D1. Turing-Computability Turing-Computable Functions

Church-Turing Thesis

Church-Turing Thesis

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

German: Church-Turing-These

I cannot be proven (why not?)

I but we will collect evidence for it ( part F)

Gabriele R¨oger (University of Basel) Theory of Computer Science April 8, 2019 9 / 21

D1. Turing-Computability Turing-Computable Functions

Reminder: Deterministic Turing Machine (DTM)

Definition (Deterministic Turing Machine)

A deterministic Turing machine (DTM) is given by a 7-tuple M = hQ, Σ, Γ, δ, q 0 , , E i with:

I Q finite, non-empty set of states

I Σ 6= ∅ finite input alphabet

I Γ ⊃ Σ finite tape alphabet

I δ : (Q \ E ) × Γ → Q × Γ × {L, R, N} transition function

I q 0 ∈ Q start state

I ∈ Γ \ Σ blank symbol

I E ⊆ Q end states

Gabriele R¨oger (University of Basel) Theory of Computer Science April 8, 2019 10 / 21

D1. Turing-Computability Turing-Computable Functions

Reminder: Configurations and Computation Steps

How do Turing Machines Work?

I configuration: hα, q, βi with α ∈ Γ , q ∈ Q, β ∈ Γ +

I one computation step: c ` c 0 if one computation step can turn configuration c into configuration c 0

I multiple computation steps: c ` c 0 if 0 or more computation steps can turn configuration c into configuration c 0

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

D1. Turing-Computability Turing-Computable Functions

Computation of Functions?

How can a DTM compute a function?

I “Input” x is the initial tape content

I “Output” f (x ) is the tape content (ignoring blanks at the left and right) when reaching an end state

I 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?

I directly, only functions on words: f : Σ p Σ

I interpretation as functions on numbers f : N k 0 → p N 0 :

encode numbers as words

(4)

Turing Machines: Computed Function

Definition (Function Computed by a Turing Machine)

A DTM M = hQ, Σ, Γ, δ, q 0 , , E i computes the (partial) function f : Σ p Σ for which:

for all x , y ∈ Σ : f (x ) = y iff hε, q 0 , xi ` h . . . , q e , y . . . i with q e ∈ E . (special case: initial configuration hε, q 0 , i if x = ε) German: DTM berechnet f

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

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

I Is f uniquely defined by this definition? Why?

Gabriele R¨oger (University of Basel) Theory of Computer Science April 8, 2019 13 / 21

Turing-Computable Functions on Words

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

A (partial) function f : Σ p Σ is called Turing-computable if a DTM that computes f exists.

German: Turing-berechenbar

Gabriele R¨oger (University of Basel) Theory of Computer Science April 8, 2019 14 / 21

D1. Turing-Computability Turing-Computable Functions

Example: Turing-Computable Functions on Words

Example

Let Σ = {a, b, #}.

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

blackboard

D1. Turing-Computability Turing-Computable Functions

Encoding Numbers as Words

Definition (Encoded Function)

Let f : N k 0p N 0 be a (partial) function.

The encoded function f code of f is the partial function f code : Σ p Σ with Σ = {0, 1, #} and f code (w ) = w 0 iff

I there are n 1 , . . . , n k , n 0 ∈ N 0 such that

I f (n 1 , . . . , n k ) = n 0 ,

I w = bin(n 1 )# . . . #bin(n k ) and

I w 0 = bin(n 0 ).

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

German: kodierte Funktion

(5)

D1. Turing-Computability Turing-Computable Functions

Turing-Computable Numerical Functions

Definition (Turing-Computable, f : N k 0p N 0 )

A (partial) function f : N k 0 → p N 0 is called Turing-computable if a DTM that computes f code exists.

German: Turing-berechenbar

Gabriele R¨oger (University of Basel) Theory of Computer Science April 8, 2019 17 / 21

D1. Turing-Computability Turing-Computable Functions

Example: Turing-Computable Numerical Function

Example

The following numerical functions are Turing-computable:

I succ : N 0 → p N 0 with succ(n) := n + 1

I pred 1 : N 0 → p N 0 with pred 1 (n) :=

( n − 1 if n ≥ 1 0 if n = 0

I pred 2 : N 0 → p N 0 with pred 2 (n) :=

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

Gabriele R¨oger (University of Basel) Theory of Computer Science April 8, 2019 18 / 21

D1. Turing-Computability Turing-Computable Functions

More Turing-Computable Numerical Functions

Example

The following numerical functions are Turing-computable:

I add : N 2 0 → p N 0 with add(n 1 , n 2 ) := n 1 + n 2

I sub : N 2 0p N 0 with sub(n 1 , n 2 ) := max{n 1 − n 2 , 0}

I mul : N 2 0p N 0 with mul(n 1 , n 2 ) := n 1 · n 2

I div : N 2 0p N 0 with div(n 1 , n 2 ) :=

(l n

1

n

2

m

if n 2 6= 0 undefined if n 2 = 0 sketch?

D1. Turing-Computability Summary

D1.2 Summary

(6)

Summary

I main question: what can a computer compute?

I approach: investigate formal models of computation

I here: deterministic Turing machines

I Turing-computable function f : Σ 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)

I Turing-computable function f : N k 0 → p N 0 :

ditto; numbers encoded in binary and separated by #

Gabriele R¨oger (University of Basel) Theory of Computer Science April 8, 2019 21 / 21

Referenzen

ÄHNLICHE DOKUMENTE

The new grammar has all original rules except that S is replaced with a new variable S’ (allowing to derive everything from S’ that could originally be derived from the start

In addition, it has rules that allow to start from the original start variable but switch to S’ after the first rule application:. S

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...

for 2.: identical to (1), only that M B only recognizes B and therefore the simulation does not necessarily terminate if y 6∈ B. Since y 6∈ B iff x 6∈ A, the procedure still

for 2.: identical to (1), only that M B only recognizes B and therefore the simulation does not necessarily terminate if y 6∈ B. Since y 6∈ B iff x 6∈ A, the procedure still

I Instead, we prove a much more general result, Rice’s theorem, which shows that a very large class of different problems are undecidable.. I Rice’s theorem can be summarized

An oracle machine is like a Turing machine that has access to an oracle which can solve some decision problem in constant timeA. Example