Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology...

105
Theory of computing, part 4

description

Turing machines

Transcript of Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology...

Page 1: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

Theory of computing, part 4

Page 2: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

1 Introduction2 Theoretical background

Biochemistry/molecular biology3 Theoretical background computer science4 History of the field5 Splicing systems6 P systems7 Hairpins

8 Detection techniques

9 Micro technology introduction

10 Microchips and fluidics11 Self assembly12 Regulatory networks13 Molecular motors14 DNA nanowires15 Protein computers16 DNA computing - summery17 Presentation of essay and discussion

Course outline

Page 3: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

Turing machines

Page 4: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

*aRegular Languages

Context-Free Languages

nnba Rww

nnn cba ww

**ba

The language hierarchy

Page 5: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

*aRegular Languages

Context-Free Languages

nnba Rww

nnn cba ww

**ba

Languages accepted byTuring Machines

The language hierarchy

Page 6: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

............Tape

Read-Write head

Control Unit

A Turing machine

Page 7: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

............

Read-Write head

No boundaries -- infinite length

The head moves Left or Right

The tape

Page 8: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

............

Read-Write head

The head at each time step:1. Reads a symbol2. Writes a symbol3. Moves Left or Right

The tape

Page 9: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

............

Time 0

............

Time 1

1. Reads

2. Writes

a a cb

a b k c

ak

3. Moves Left

Example

Page 10: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

............Time 1

a b k c

............Time 2

a k cf

bf

Example

1. Reads

2. Writes

3. Moves Left

Page 11: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

............

Blank symbol

head

a b ca

Head starts at the leftmost position of the input string

Input string

The input string

Page 12: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

1q 2qLba ,

Read WriteMove Left

1q 2qRba ,

Move Right

States and transitions

Page 13: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

1q 2qRba ,

............ a b caTime 1

1qcurrent state

Example

Page 14: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

............ a b caTime 1

1q 2qRba ,

............ a b cbTime 2

1q

2q

Example

Page 15: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

............ a b caTime 1

1q 2qLba ,

............ a b cbTime 2

1q

2q

Example

Page 16: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

............ a b caTime 1

1q 2qRg,

............ ga b cbTime 2

1q

2q

Example

Page 17: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

1q

2qRba ,

Allowed Not Allowed

3qLdb ,

1q

2qRba ,

3qLda ,

Turing Machines are deterministic

Determinism

Page 18: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

1q

2qRba ,

3qLdb ,

............ a b ca

1q

No transitionfor input symbol c

Allowed:

Example: partial transition function

Page 19: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

The machine halts if there are no possible transitions to follow

Halting

Page 20: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

............ a b ca

1q

1q

2qRba ,

3qLdb ,

No possible transition HALT

Example

Page 21: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

1q 2q Allowed

1q 2q Not Allowed

Final states have no outgoing transitions

In a final state the machine halts

Final states

Page 22: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

Accept InputIf machine halts in a final state

Reject Input

If machine halts in a non-final state or If machine enters an infinite loop

Acceptance

Page 23: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

A Turing machine that accepts language a*

0q

Raa ,

L,1q

Turing machine example

Page 24: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

aaTime 0

0q

a

0q

Raa ,

L,1q

Turing machine example

Page 25: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

aaTime 1

0q

a

0q

Raa ,

L,1q

Turing machine example

Page 26: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

aaTime 2

0q

a

0q

Raa ,

L,1q

Turing machine example

Page 27: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

aaTime 3

0q

a

0q

Raa ,

L,1q

Turing machine example

Page 28: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

aaTime 4

1q

a

0q

Raa ,

L,1q

Halt & Accept

Turing machine example

Page 29: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

0q

Raa ,

L,1q

baTime 0

0q

a

Rejection example

Page 30: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

0q

Raa ,

L,1q

baTime 1

0q

a

No possible Transition

Halt & Reject

Rejection example

Page 31: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

0q

Raa ,

L,1q

Lbb ,

Another Turing machine for language a*

and is this one correct???

Infinite loop example

Page 32: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

baTime 0

0q

a

0q

Raa ,

L,1q

Lbb ,

Infinite loop example

Page 33: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

baTime 1

0q

a

0q

Raa ,

L,1q

Lbb ,

Infinite loop example

Page 34: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

baTime 2

0q

a

0q

Raa ,

L,1q

Lbb ,

Infinite loop example

Page 35: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

baTime 2

0q

a

baTime 3

0q

a

baTime 4

0q

a

baTime 5

0q

a

... Infinite Loop

Infinite loop example

Page 36: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

Because of the infinite loop:

The final state cannot be reached

The machine never halts

The input is not accepted

Infinite loop example

Page 37: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

Turing machine for the language }{ nnba

0q 1q 2q3qRxa ,

Raa ,Ryy ,

Lyb ,

Laa ,Lyy ,

Rxx ,

Ryy ,

Ryy ,4q

L,

Another Turing machine example

Page 38: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

0q 1q 2q3qRxa ,

Raa ,Ryy ,

Lyb ,

Laa ,Lyy ,

Rxx ,

Ryy ,

Ryy ,4q

L,

ba

0q

a bTime 0

Another Turing machine example

Page 39: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

0q 1q 2q3qRxa ,

Raa ,Ryy ,

Lyb ,

Laa ,Lyy ,

Rxx ,

Ryy ,

Ryy ,4q

L,

bx

1q

a b Time 1

Another Turing machine example

Page 40: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

0q 1q 2q3qRxa ,

Raa ,Ryy ,

Lyb ,

Laa ,Lyy ,

Rxx ,

Ryy ,

Ryy ,4q

L,

bx

1q

a b Time 2

Another Turing machine example

Page 41: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

0q 1q 2q3qRxa ,

Raa ,Ryy ,

Lyb ,

Laa ,Lyy ,

Rxx ,

Ryy ,

Ryy ,4q

L,

yx

2q

a b Time 3

Another Turing machine example

Page 42: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

0q 1q 2q3qRxa ,

Raa ,Ryy ,

Lyb ,

Laa ,Lyy ,

Rxx ,

Ryy ,

Ryy ,4q

L,

yx

2q

a b Time 4

Another Turing machine example

Page 43: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

0q 1q 2q3qRxa ,

Raa ,Ryy ,

Lyb ,

Laa ,Lyy ,

Rxx ,

Ryy ,

Ryy ,4q

L,

yx

0q

a b Time 5

Another Turing machine example

Page 44: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

0q 1q 2q3qRxa ,

Raa ,Ryy ,

Lyb ,

Laa ,Lyy ,

Rxx ,

Ryy ,

Ryy ,4q

L,

yx

1q

x b Time 6

Another Turing machine example

Page 45: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

0q 1q 2q3qRxa ,

Raa ,Ryy ,

Lyb ,

Laa ,Lyy ,

Rxx ,

Ryy ,

Ryy ,4q

L,

yx

1q

x b Time 7

Another Turing machine example

Page 46: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

0q 1q 2q3qRxa ,

Raa ,Ryy ,

Lyb ,

Laa ,Lyy ,

Rxx ,

Ryy ,

Ryy ,4q

L,

yx x y

2q

Time 8

Another Turing machine example

Page 47: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

0q 1q 2q3qRxa ,

Raa ,Ryy ,

Lyb ,

Laa ,Lyy ,

Rxx ,

Ryy ,

Ryy ,4q

L,

yx x y

2q

Time 9

Another Turing machine example

Page 48: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

0q 1q 2q3qRxa ,

Raa ,Ryy ,

Lyb ,

Laa ,Lyy ,

Rxx ,

Ryy ,

Ryy ,4q

L,

yx

0q

x y Time 10

Another Turing machine example

Page 49: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

0q 1q 2q3qRxa ,

Raa ,Ryy ,

Lyb ,

Laa ,Lyy ,

Rxx ,

Ryy ,

Ryy ,4q

L,

yx

3q

x y Time 11

Another Turing machine example

Page 50: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

0q 1q 2q3qRxa ,

Raa ,Ryy ,

Lyb ,

Laa ,Lyy ,

Rxx ,

Ryy ,

Ryy ,4q

L,

yx

3q

x y Time 12

Another Turing machine example

Page 51: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

0q 1q 2q3qRxa ,

Raa ,Ryy ,

Lyb ,

Laa ,Lyy ,

Rxx ,

Ryy ,

Ryy ,4q

L,

yx

4q

x y

Halt & Accept

Time 13

Another Turing machine example

Page 52: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

If we modify the machine for the language

}{ nnba

we can easily construct a machine for the language

}{ nnn cba

Observation

Page 53: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

Formal definitions

Page 54: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

1q 2qRba ,

),,(),( 21 Rbqaq

Transition function

Page 55: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

1q 2qLdc ,

),,(),( 21 Ldqcq

Transition function

Page 56: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

),,,,,,( 0 FqQM

States

Input alphabet Tape alphabet

Transition function

Initial state blank

Final states

Turing machine

Page 57: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

ba

1q

a

Instantaneous description:

c

baqca 1

Configuration

Page 58: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

yx

2q

a bTime 4

yx

0q

a bTime 5

A Move: aybqxxaybq 02

Configuration

Page 59: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

yx

2q

a bTime 4

yx

0q

a bTime 5

bqxxyybqxxaybqxxaybq 1102

yx

1q

x bTime 6

yx

1q

x bTime 7

Configuration

Page 60: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

bqxxyybqxxaybqxxaybq 1102

bqxxyxaybq 12Equivalent notation:

Configuration

Page 61: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

wq0

ba

0q

a b

wInput string

Initial configuration

Page 62: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

For any Turing Machine M

}:{)( 210 xqxwqwML f

Initial state Final state

The accepted language

Page 63: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

Deterministic

Infinite tape in both directions

Tape is the input/output file

The machine we described is the standard

Standard Turing machine

Page 64: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

Computing functions

Page 65: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

A function )(wf

Domain: Result Region:

has:

D

Dw

S

Swf )()(wf

Functions

Page 66: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

A function may have many parameters

yxyxf ),(

Example:

Addition function

Functions

Page 67: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

Unary:

Binary:

Decimal:

11111

101

5

We prefer unary representation:

easier to manipulate with Turing machines

Integer domain

Page 68: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

A function is computable ifthere is a Turing Machine such that:

fM

Initial configuration Final configuration

Dw Domain

0q

w

fq

)(wf

final stateinitial state

For all

Functions definition

Page 69: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

)(0 wfqwq f

Initial Configuration

FinalConfiguration

Functions definition

A function is computable ifthere is a Turing Machine such that:

fM

Dw DomainFor all

Page 70: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

The function yxyxf ),( is computable

Turing Machine:

Input string: yx0 unary

Output string: 0xy unary

yx, are integers

Example

Page 71: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

0

0q

1 1 1 1

x y

1Start

initial state

The 0 is the delimiter that separates the two numbers

Example

Page 72: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

0

0q

1 1 1 1

x y

1

0

fq

1 1

yx

11

Start

Finish

final state

initial state

Example

Page 73: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

0

fq

1 1

yx

11Finish

The 0 helps when we use the result for other operations

Example

final state

Page 74: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

0q

Turing machine for function

1q 2q 3qL, L,01

L,11

R,

R,10

R,11

4q

R,11

yxyxf ),(

Turing machine example

Page 75: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

Execution Example:

11x

11y 0

0q

1 1 1 1

Time 0

x y

Final Result

0

4q

1 1 1 1yx

(2)

(2)

Turing machine example

Page 76: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

0

0q

1 1

0q 1q 2q 3qL, L,01

L,11

R,

R,10

R,11

4q

R,11

1 1Time 0

Turing machine example

Page 77: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

0q

0q 1q 2q 3qL, L,01

L,11

R,

R,10

R,11

4q

R,11

01 11 1Time 1

Turing machine example

Page 78: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

0q 1q 2q 3qL, L,01

L,11

R,

R,10

R,11

4q

R,11

0

0q

1 1 1 1Time 2

Turing machine example

Page 79: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

0q 1q 2q 3qL, L,01

L,11

R,

R,10

R,11

4q

R,11

1q

1 11 11Time 3

Turing machine example

Page 80: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

0q 1q 2q 3qL, L,01

L,11

R,

R,10

R,11

4q

R,11

1q

1 1 1 11Time 4

Turing machine example

Page 81: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

0q 1q 2q 3qL, L,01

L,11

R,

R,10

R,11

4q

R,11

1q

1 11 11Time 5

Turing machine example

Page 82: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

0q 1q 2q 3qL, L,01

L,11

R,

R,10

R,11

4q

R,11

2q

1 1 1 11Time 6

Turing machine example

Page 83: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

0q 1q 2q 3qL, L,01

L,11

R,

R,10

R,11

4q

R,11

3q

1 11 01Time 7

Turing machine example

Page 84: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

0q 1q 2q 3qL, L,01

L,11

R,

R,10

R,11

4q

R,11

3q

1 1 1 01Time 8

Turing machine example

Page 85: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

0q 1q 2q 3qL, L,01

L,11

R,

R,10

R,11

4q

R,11

3q

1 11 01Time 9

Turing machine example

Page 86: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

0q 1q 2q 3qL, L,01

L,11

R,

R,10

R,11

4q

R,11

3q

1 1 1 01Time 10

Turing machine example

Page 87: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

0q 1q 2q 3qL, L,01

L,11

R,

R,10

R,11

4q

R,11

3q

1 11 01Time 11

Turing machine example

Page 88: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

0q 1q 2q 3qL, L,01

L,11

R,

R,10

R,11

4q

R,11

4q

1 1 1 01

HALT & accept

Time 12

Turing machine example

Page 89: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

The function xxf 2)( is computable

Turing Machine:

Input string: x unary

Output string: xx unary

x is integer

Another example

Page 90: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

0q

1 1

x

1

1

fq

1 1

x2

11

Another example

Start

Finish

final state

initial state

Page 91: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

Turing Machine Pseudocode for xxf 2)( Replace every 1 with $

Repeat:

Find rightmost $, replace it with 1

Go to right end, insert 1

Until no more $ remain

Pseudocode

Page 92: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

0q 1q 2q

3q

R,1$

L,1

L,

R$,1 L,11 R,11

R,

Turing Machine for xxf 2)(

Example

Page 93: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

0q 1q 2q

3q

R,1$

L,1

L,

R$,1 L,11 R,11

R,

0q

1 1

3q

1 11 1

Start Finish

Example

Page 94: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

The function

),( yxf

is computable

0

1 yx

yx

if

if

Another example

Page 95: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

Turing Machine for

Input: yx0

Output: 1 0or

),( yxf0

1 yx

yx

if

if

Another example

Page 96: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

Match a 1 from with a 1 from x yRepeat

Until all of or is matchedx y

If a 1 from is not matched erase tape, write 1 else erase tape, write 0

x)( yx

)( yx

Pseudocode

Page 97: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

Combining Turing machines

Page 98: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

Block Diagram

Turing Machineinput output

Combining Turing machines

Page 99: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

),( yxf0

yx yx

yx

if

if

Comparer

Adder

Eraser

yx,

yx,

yx

yx

yx

0

Example

Page 100: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

Turing’s thesis

Page 101: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

Do Turing machines have the same power with a digital computer?

Intuitive answer: Yes

There is no formal answer!!!

Question:

Turing’s thesis

Page 102: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

Any computation carried out by mechanical means can be performed by a Turing Machine

(1930)

Turing’s thesis

Page 103: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

A computation is mechanical if and only if it can be performed by a Turing Machine

There is no known model of computation more powerful than Turing Machines

Computer science law

Page 104: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

An algorithm for functionis a Turing Machine which computes

)(wf

Definition of an algorithm

)(wf

Page 105: Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.

When we say:

There exists an algorithm

We mean:

There exists a Turing Machinethat executes the algorithm

Algorithms are Turing machines