Good Notes

© All Rights Reserved

13 views

Good Notes

© All Rights Reserved

- dfick_1.pdf
- 7053T-TP4 - S8-R1
- Turing Machine
- If a Tree Casts a Shadow is It
- 1360 - 868-367-170
- Imp Synchronous Design With Verilog
- Final Term August 2010 CS101
- WPI_Log_2011.04.26_10.21.16
- Deconstructing Kernels by Torricelli Baracca
- BSC Alarm Parameters
- mc0077 july 2011
- ch1
- Canon iR1530 Pc
- Led Matrix 24x6
- Via EPIA-P900 Datasheet v120213
- New Text Document
- Sonar
- Predavanje_5_TuringMachine_
- Comp Sci Notes 2
- 23demo Factorial

You are on page 1of 27

g Machines

Reading: Chapter 8

1

Turing Machines are

Very powerful (abstract) machines that

could simulate any modern day

computer (although very, very slowly!)

For every input,

answer YES or NO

Why design such a machine?

If a p

problem cannot be solved even usingg

a TM, then it implies that the problem is

undecidable

A Turing Machine (TM)

This is like

M = (Q, , , , q0,B,F) the CPU &

program

counter

t

Finite

control Tape is the

memory

Tape head

Infinite tape

p with tape

p symbols

y

B B B X1 X2 X3 Xi Xn B B

B: blank symbol (special symbol reserved to indicate data boundary)

3

You can also use:

for R

in a TM does the following: X / Y,D

(q,X) = (p,Y,D) q p

q is the current state

X is the current tape symbol pointed by

tape head

State changes from q to p

After the move:

X is replaced with symbol Y

If D=L, the tape head moves left by

one position.

Alternatively, if D=R

D R the tape head

moves right by one position.

4

ID of a TM

Instantaneous Description or ID :

X1X2Xi-1qXiXi+1Xn

means:

q is the current state

Tape head is pointing g to Xi

X1X2Xi-1XiXi+1Xn are the current tape symbols

( Xi) = ((p,Y,R)

(q,X Y R) iis same as:

X1Xi-1qXiXn |---- X1Xi-1YpXi+1Xn

(q Xi) = (p,Y,L)

(q,X (p Y L) is same as:

X1Xi-1qXiXn |---- X1pXi-1YXi+1Xn

5

Way to check for Membership

Is a string w accepted by a TM?

Initial condition:

The (whole) input string w is present in TM,

preceded and followed by infinite blank symbols

Final acceptance:

Accept w if TM enters final state and halts

If TM halts and not final state, then reject

6

Example: L = {0 1

n n | n1}

Strategy: w = 000111

B B 0 0 0 1 1 1 B B B B X X 0 Y Y 1 B B

B B X 0 0 1 1 1 B B B B X X X Y Y 1 B B

B B X 0 0 Y 1 1 B B B B X X X Y Y Y B B

B B X X 0 Y 1 1 B B

B B X X X Y Y Y B B

Accept 7

TM for {0 1

n n | n1}

Y / Y,R 1. Mark next unread 0 with X

0 / 0,R and move right

2. Move to the right all the way

0 / X,R

XR to the first unread 1

1, and mark

q0 q1 it with Y

3. Move back (to the left) all the

Y / Y,R

YR 1 / Y,L way to the last marked X, and

then move one position to the

X / X,R right

q2

q3 4. If the next position is 0, then

Y / Y,R goto step

g p 1.

Y / Y,L Else move all the way to the

B / B,R right to ensure there are no

0 / 0,L excess 1s. If not move right to

q4

the next blank symbol and

stop & accept.

8

*state diagram representation preferred

TM for {0 1

n n | n1}

Next Tape Symbol

Curr. 0 1 X Y B

State

q0 (q1,X,R) - - (q3,Y,R) -

q3 - - - (q3,Y,R) (q4,B,R)

*q4 - -- - - -

9

TMs for calculations

TMs can also be used for calculating

values

Like arithmetic computations

Eg addition,

Eg., addition subtraction

subtraction, multiplication

multiplication,

etc.

10

Example 2: monus subtraction

m -- n = max{m-n,0}

0m10n ...B 0m-n B.. (if m>n)

...BBB.. (otherwise)

1. For every 0 on the left (mark X), mark off a 0 on the right

(mark Y)

am

ate diagra

1. // No more 0s remaining on the left of 1

Answer is 0, so flip all excess 0s on the right of 1 to Bs

( d th

(and the 1 ititself)

lf) and

dhhalt

lt

Give sta

Answer is m-n, so simply halt after making 1 to B

11

Example 3: Multiplication

0m10n1 (input), 0mn1 (output)

Pseudocode:

1. Move tape head back & forth such that for every

am

ate diagra

delimiting 1

2. Once written, that zero is changed to B to get

marked

k d as fifinished

i h d

Give sta

remainingg n 0s and 1s also as Bs

12

Calculations vs. Languages

The language for a certain

A calculation is one calculation is the set of strings of

that takes an input the form <input, output>, where

and outputs a value the output corresponds to a valid

(or values) calculated value for the input

A language is a set

E.g., The language Ladd for the addition operation

of strings that meet

certain criteria <0#0,0>

<0#1,1>

<2#4,6>

Membership question == verifying a solution

e.g., is <15#12,27> a member of Ladd ? 13

Language

g g of the Turing

g

Machines

Recursive Enumerable (RE) language

Regular Context-

nsitive

erable

sively

ntext

(DFA)

free

Con

Recurs

Enume

sen

(PDA)

14

Variations of Turing Machines

15

Generic description

Will work for both a=0 and a=1

TMs with storage

E.g., TM for 01* + 10*Current

Tape Next

Current Storage symbol state

state symbol New

N

Storage

symbol

q Transition function :

storage

([q0,B],a) = ([q1,a], a, R)

Tape head ([q1,a],a) = ([q1,a], a, R)

B B 0 1 1 1 1 1 B B

([q1,a],B) = ([q2,B], B, R)

[q,a]: where q is current state,

equivalent to TMs with storage?

a is the symbol in storage 16

Standard TMs are equivalent to TMs

with storage - Proof

Claim: Every TM w/ storage can be simulated

by a TM w/o storage as follows:

For every [state, symbol] combination in

the TM w/ storage:

Create a new state in the TM w/o storage

Define transitions induced by TM w/ storage

symbols in the TM with storage

storage, the number of states

in the TM without storage will also be finite

17

Multi-track Turing Machines

TM with multiple tracks,

but just one unified tape head

control

One tape head to read

k symbols from the k tracks

at one step.

T k1

Track

Track 2

Track k

18

Multi-Track TMs

TM with multiple tracks but just one

head E.g.,

g TM for {{wcw | w {{0,1}*

} }

but w/o modifying original input string

BEFORE AFTER

control

t l control

t l

B B 0 1 0 c 0 1 0 B Track 1 B B 0 1 0 c 0 1 0 B Track 1

B B B B B B B B B B Track 2 B B X X X c Y Y Y B Track 2

19

Second track mainly used as a scratch space for marking

Multi-track TMs are equivalent

q

to basic (single-track) TMs

Let M be a single-track TM

M = (Q, , , , q0,B,F)

M (Q , ,

M = (Q , , q

q0,B,F

B F))

(qi,<a1,a2,ak>) = (qj, <b1,b2,bk>, L/R)

Claims:

For every M, there is an M s.t. L(M)=L(M).

(proof trivial here)

20

Multi-track TM ==> TM (proof)

For every M, there is an M s.t. L(M)=L(M).

Main idea:

M = (Q,

(Q , ,

,

q0,[B,B,],F)

[B B ] F) Create one composite

Where: symbol to represent

Q = Q every combination of

k track) k symbols

= x x (k times for k-track)

y

= x x (k times for k-track)

q0 = q0

F = F

p

represent single-track

g TMs,, and is a matter of

design convenience.

21

Multi-tape Turing Machines

TM with multiple tapes, each tape with a

separate head

Each head can move independently of the

others

control

k separate heads

Tape 1

Tape 2

Tape k 22

On how a Multi-tape

p TM would

operate

Initially:

The input is in tape #1 surrounded by blanks

st

input

The heads for all other tapes

p p point at an arbitrary

y cell

(doesnt matter because they are all blanks anyway)

A move:

Is a function (current state, the symbols pointed by all the

heads)

After each move, each tape head can move independently

( f or right)) off one another

(left

23

Multitape TMs Basic TMs

Theorem: Every language accepted by a k-

tape

p TM is also accepted

p by

y a single-tape

g p TM

Proof by construction:

Construct a single-tape TM with 2k tracks, where

each tape of the k-tape TM is simulated by 2

tracks of basic TM

k out the 2k tracks simulate the k input tapes

The other k out of the 2k tracks keep track of the k

tape head positions

24

Multitape TMs Basic TMs

To simulate one move of the k-tape TM:

Move from the leftmost marker to the rightmost marker (k markers) and in

the process, gather all the input symbols into storage

Then, take the action same as done by the k-tape TM (rewrite tape symbols

& move L/R using the markers)

control

storage

Track 1 x

A1 A2 Ai

Track 2

x

Track 3

B1 B2 Bi Bj

Track 4

25

Non-deterministic TMs Deterministic TMs

Non-deterministic TMs

A TM can have non-deterministic moves:

(q,X) = { (q1,Y1,D1), (q2,Y2,D2), }

Simulation using a multitape deterministic

TM:

Control

Input tape

ID1 ID2 ID3 ID4

Marker tape * * * *

Scratch tape

26

Summary

TMs == Recursively Enumerable languages

TMs can be used as both:

Language recognizers

Calculators/computers

B i TM is

Basic i equivalent

i l t tot all

ll the

th below:

b l

1. TM + storage

2

2. Multi-track

Multi track TM

3. Multi-tape TM

4. Non-deterministic TM

TMs are like universal computing machines

with unbounded storage 27

- dfick_1.pdfUploaded byabijosh
- 7053T-TP4 - S8-R1Uploaded byahadweb
- Turing MachineUploaded byvishwasg123
- If a Tree Casts a Shadow is ItUploaded byapi-3825948
- 1360 - 868-367-170Uploaded byDuong Tran
- Imp Synchronous Design With VerilogUploaded byMiguel Bruno
- Final Term August 2010 CS101Uploaded byTaimoor Sultan
- WPI_Log_2011.04.26_10.21.16Uploaded byjuanda32
- Deconstructing Kernels by Torricelli BaraccaUploaded byalvarito2009
- BSC Alarm ParametersUploaded byandwanda
- mc0077 july 2011Uploaded bykiller1
- ch1Uploaded byaloha_1212
- Canon iR1530 PcUploaded byVrtec Gabrovka Glasovanje
- Led Matrix 24x6Uploaded byJoniq Onex
- Via EPIA-P900 Datasheet v120213Uploaded byBrandon Vandegrift
- New Text DocumentUploaded byTrinh Van Hiep
- SonarUploaded byKrunk Jn
- Predavanje_5_TuringMachine_Uploaded bySabina Karahodzic
- Comp Sci Notes 2Uploaded bySam Wang
- 23demo FactorialUploaded byDaWheng Vargas
- About Primitive PromotionUploaded bypavani21
- scimakelatex.29021.Juanito+verde.Juln+mtz.pdfUploaded byjohnturkleton
- The Foundations of ExistenceUploaded byWilliam McGarvey
- Liteon Pa-1121-04cp Laptop Ac Adapter Power SupplyUploaded byAlex Fernandez
- Oo2 Temp.inoUploaded bygprodan2002a2948
- msa-v001Uploaded byrabeek
- MappingUploaded byAhmad Yon Khoerul
- Taller Capitulo 4 Clasificacion (Solucion)Uploaded byFabian Alejandro León Almeciga
- JavaEx6Uploaded byEco Buy
- ECE_SEM2_15101105022Uploaded byABHISHEK CHOWDHURY

- Women Uncensored: Raw Talk with Tico & Addi Takes to the Airwaves to Address Issues Facing Women of ColorUploaded byPR.com
- Interlocking BlocksUploaded byKhai Untalan Urlanda
- Geo ReportUploaded byRaghav Bhasin
- CFS2 Mission Building HandBookUploaded byscribdadiddly
- Customer Knowledge Management SystemUploaded byInnocent Zee
- ct52010-2013Uploaded byWei Seong
- Como Adjuntar Documentos VisaUploaded byIsabel Vega Villablanca
- 2bachiller english exercisesUploaded byld25
- 03-Walkthrough Workshop-1 Develop a Custom Load Extension (Reuse APDL)Uploaded byrewmarine
- 5-Hojas de SeguridadUploaded byCamilo Serna
- Technical Textile FibersUploaded byDr Muhammad Mushtaq Mangat
- Mansouri 2010 FactorsUploaded byMadhu
- The Young Language LearnerUploaded byharisiik
- lesson planUploaded byapi-282433560
- ENGALGUploaded byclarkdustin1106
- Tugas 1 Emotional IntelligenceUploaded byKordelya
- ASTM D 1452-80 Standard Parctice for Soil Investigation and Sampling by Auger BoringsUploaded byPablo Antonio Valcárcel Vargas
- Thesis121Uploaded byLjiljana Petrovic Ex Bazovic
- Manager's QualitiesUploaded byramilfleco
- UfoneUploaded byMahaAqeel
- F2393.1479757-1Uploaded byThaweekarn Changthong
- heizer_om10_ch05Uploaded byNaeldel Lizelle Cruz
- make a battery from potatoUploaded byapi-311981872
- travel chinaUploaded byLawrence Lim Ah Kow
- EJX HART 3 ManualUploaded byCecep Atmega
- 10.1.1.70Uploaded byOmid Alizadeh Mousavi
- 121784176-Pa-System1.pdfUploaded byToàn Vũ Đình
- AP Chem CH 13 Practice QuizUploaded byHasantha Perera
- AnthropometryUploaded byImar Masriyah
- Future of Travel Exec Summary Business FinalUploaded byswedenborgeano123