• No results found

CS310 : Automata Theory 2019

N/A
N/A
Protected

Academic year: 2022

Share "CS310 : Automata Theory 2019"

Copied!
28
0
0

Loading.... (view fulltext now)

Full text

(1)

CS310 : Automata Theory 2019

Lecture 25: Turing Machines and Computability

Instructor: S. Akshay

IITB, India

(2)

Turing Machines

Definition

A Turing Machine is a 7-tuple (Q,Σ,Γ, δ,q0,qacc,qrej) where 1. Q is a finite set ofstates,

2. Σ is afinite input alphabet,

3. Γ is afinite tape alphabet wheret ∈Γ and Σ⊆Γ, 4. q0 is the startstate,

5. qacc is the acceptstate, 6. qrej is the rejectstate,

7. δ :Q×Γ→Q×Γ× {L,R}is the transition function.

(3)

Turing Machines

Definition

A Turing Machine is a 7-tuple (Q,Σ,Γ, δ,q0,qacc,qrej) where 1. Q is a finite set ofstates,

2. Σ is afinite input alphabet,

3. Γ is afinite tape alphabet wheret ∈Γ and Σ⊆Γ, 4. q0 is the startstate,

5. qacc is the acceptstate, 6. qrej is the rejectstate,

7. δ :Q×Γ→Q×Γ× {L,R}is the transition function.

(4)

Configurations

A configuration is a snapshot of the system during computation.

Described by:

current state,tape contents andcurrent head location. Notation: C =uqv

where,uv is the tape content, current state isq and head is at start of v We defineC1 yields C2 if the TM can move fromC1 toC2 in one step:

I left move: u a qi b v yields u qj a c v ifδ(qi,b) = (qj,c,L) I right move: u a qi b v yields u a c qj v ifδ(qi,b) = (qj,c,R)

I right-end: assume thatu a qi is the same asu a qi tas tape has blanks to the right.

I left-end (for single side infinite tape): qi b v yields (1)qj c v if transition is left moving or (2)c qj v if it is right moving

(5)

Configurations

A configuration is a snapshot of the system during computation.

Described by: current state,tape contents andcurrent head location.

Notation: C =uqv

where,uv is the tape content, current state isq and head is at start of v We defineC1 yields C2 if the TM can move fromC1 toC2 in one step:

I left move: u a qi b v yields u qj a c v ifδ(qi,b) = (qj,c,L) I right move: u a qi b v yields u a c qj v ifδ(qi,b) = (qj,c,R)

I right-end: assume thatu a qi is the same asu a qi tas tape has blanks to the right.

I left-end (for single side infinite tape): qi b v yields (1)qj c v if transition is left moving or (2)c qj v if it is right moving

(6)

Configurations

A configuration is a snapshot of the system during computation.

Described by: current state,tape contents andcurrent head location.

Notation: C =uqv

where, uv is the tape content, current state is q and head is at start of v

We defineC1 yields C2 if the TM can move fromC1 toC2 in one step: I left move: u a qi b v yields u qj a c v ifδ(qi,b) = (qj,c,L) I right move: u a qi b v yields u a c qj v ifδ(qi,b) = (qj,c,R)

I right-end: assume thatu a qi is the same asu a qi tas tape has blanks to the right.

I left-end (for single side infinite tape): qi b v yields (1)qj c v if transition is left moving or (2)c qj v if it is right moving

(7)

Configurations

A configuration is a snapshot of the system during computation.

Described by: current state,tape contents andcurrent head location.

Notation: C =uqv

where, uv is the tape content, current state is q and head is at start of v We define C1 yields C2 if the TM can move fromC1 toC2 in one step:

I left move: u a qi b v yields u qj a c v ifδ(qi,b) = (qj,c,L) I right move: u a qi b v yields u a c qj v ifδ(qi,b) = (qj,c,R)

I right-end: assume thatu a qi is the same asu a qi tas tape has blanks to the right.

I left-end (for single side infinite tape): qi b v yields (1)qj c v if transition is left moving or (2)c qj v if it is right moving

(8)

Configurations

A configuration is a snapshot of the system during computation.

Described by: current state,tape contents andcurrent head location.

Notation: C =uqv

where, uv is the tape content, current state is q and head is at start of v We define C1 yields C2 if the TM can move fromC1 toC2 in one step:

I left move: u a qi b v yields u qj a c v ifδ(qi,b) = (qj,c,L) I right move: u a qi b v yields u a c qj v ifδ(qi,b) = (qj,c,R)

I right-end: assume thatu a qi is the same asu a qi tas tape has blanks to the right.

I left-end (for single side infinite tape): qi b v yields (1)qj c v if transition is left moving or (2)c qj v if it is right moving

(9)

Configurations

A configuration is a snapshot of the system during computation.

Described by: current state,tape contents andcurrent head location.

Notation: C =uqv

where, uv is the tape content, current state is q and head is at start of v We define C1 yields C2 if the TM can move fromC1 toC2 in one step:

I left move: u a qi b v yields u qj a c v ifδ(qi,b) = (qj,c,L) I right move: u a qi b v yields u a c qj v ifδ(qi,b) = (qj,c,R)

I right-end: assume thatu a qi is the same asu a qi tas tape has blanks to the right.

I left-end (for single side infinite tape): qi b v yields (1)qj c v if transition is left moving or (2)c qj v if it is right moving

(10)

Configurations

A configuration is a snapshot of the system during computation.

Described by: current state,tape contents andcurrent head location.

Notation: C =uqv

where, uv is the tape content, current state is q and head is at start of v We define C1 yields C2 if the TM can move fromC1 toC2 in one step:

I left move: u a qi b v yields u qj a c v ifδ(qi,b) = (qj,c,L) I right move: u a qi b v yields u a c qj v ifδ(qi,b) = (qj,c,R)

I right-end: assume thatu a qi is the same asu a qi tas tape has blanks to the right.

I left-end (for single side infinite tape): qi b v yields (1)qj c v if transition is left moving or (2)c qj v if it is right moving

(11)

Computation of a Turing Machine

I We define start (q0,w), accepting (∗qacc∗), rejecting (∗qrej∗) and halting configurations.

I A Turing Machine computation on a given input may not halt!

I A TM M acceptsinput word w if there exists a sequence of configurationsC1,C2, . . . ,Ck (called a run) such that

I C1is the start configuration I eachCi yieldsCi+1

I Ck is an accepting configuration

I Language of TMM, denotedL(M), is the set of strings accepted by it.

(12)

Computation of a Turing Machine

I We define start (q0,w), accepting (∗qacc∗), rejecting (∗qrej∗) and halting configurations.

I A Turing Machine computation on a given input may not halt!

I A TM M acceptsinput word w if there exists a sequence of configurationsC1,C2, . . . ,Ck (called a run) such that

I C1is the start configuration I eachCi yieldsCi+1

I Ck is an accepting configuration

I Language of TMM, denotedL(M), is the set of strings accepted by it.

(13)

Computation of a Turing Machine

I We define start (q0,w), accepting (∗qacc∗), rejecting (∗qrej∗) and halting configurations.

I A Turing Machine computation on a given input may not halt!

I A TMM acceptsinput word w if there exists a sequence of configurationsC1,C2, . . . ,Ck (called a run) such that

I C1 is the start configuration I eachCi yieldsCi+1

I Language of TMM, denotedL(M), is the set of strings accepted by it.

(14)

Computation of a Turing Machine

I We define start (q0,w), accepting (∗qacc∗), rejecting (∗qrej∗) and halting configurations.

I A Turing Machine computation on a given input may not halt!

I A TMM acceptsinput word w if there exists a sequence of configurationsC1,C2, . . . ,Ck (called a run) such that

I C1 is the start configuration I eachCi yieldsCi+1

I Ck is an accepting configuration

I Language of TMM, denotedL(M), is the set of strings accepted by it.

(15)

Turing recognizable and decidable languages

Turing recognizable or Recursively enumerable (r.e)

A language is Turing recognizable or r.eif there is a Turing machine accepting it.

Turing decidable or recursive

A language isdecidable(or recursive) if there is a Turing machine accepting it, which has the additional property that it halts on all possible inputs.

Every decidable language is Turing recognizable, but is the converse true?

(16)

Turing recognizable and decidable languages

Turing recognizable or Recursively enumerable (r.e)

A language is Turing recognizable or r.eif there is a Turing machine accepting it.

Turing decidable or recursive

A language is decidable(or recursive) if there is a Turing machine accepting it, which has the additional property that it halts on all possible inputs.

Every decidable language is Turing recognizable, but is the converse true?

(17)

Turing recognizable and decidable languages

Turing recognizable or Recursively enumerable (r.e)

A language is Turing recognizable or r.eif there is a Turing machine accepting it.

Turing decidable or recursive

A language is decidable(or recursive) if there is a Turing machine accepting it, which has the additional property that it halts on all possible inputs.

(18)

Variants of a Turing Machine

I Multi-tape TMs.

I Non-deterministic TMs I Multi-head TMs

I Single sided vs double sided infinite tape TMs I ...

What are the relative expressive powers? Do we get something strictly more powerful than standard TMs?

(19)

Multi-tape to single-tape TM

Definition

A multitape TMis a TM with several tapes, each having its own head for reading and writing. Input is on first tape and others are blank.

Formally,

δ:Q×Γk →Q×Γk× {L,R}k, wherek is the number of tapes.

δ(qi,a1, . . . ,ak) = (qj,b1, . . . ,bk,L,R, . . . ,L)

Theorem

Every multi-tape TM has an “equivalent” single-tape TM. Proof idea:

I Keep a special marker # to separate tapes I Keep copy of alphabet to have different heads

I When you encounter # during simulation, shift cells to make space.

(20)

Multi-tape to single-tape TM

Definition

A multitape TMis a TM with several tapes, each having its own head for reading and writing. Input is on first tape and others are blank.

Formally, δ:Q×Γk →Q×Γk× {L,R}k, wherek is the number of tapes.

δ(qi,a1, . . . ,ak) = (qj,b1, . . . ,bk,L,R, . . . ,L)

Theorem

Every multi-tape TM has an “equivalent” single-tape TM. Proof idea:

I Keep a special marker # to separate tapes I Keep copy of alphabet to have different heads

I When you encounter # during simulation, shift cells to make space.

(21)

Multi-tape to single-tape TM

Definition

A multitape TMis a TM with several tapes, each having its own head for reading and writing. Input is on first tape and others are blank.

Formally, δ:Q×Γk →Q×Γk× {L,R}k, wherek is the number of tapes.

δ(qi,a1, . . . ,ak) = (qj,b1, . . . ,bk,L,R, . . . ,L)

Theorem

Every multi-tape TM has an “equivalent” single-tape TM. Proof idea:

I Keep a special marker # to separate tapes I Keep copy of alphabet to have different heads

I When you encounter # during simulation, shift cells to make space.

(22)

Multi-tape to single-tape TM

Definition

A multitape TMis a TM with several tapes, each having its own head for reading and writing. Input is on first tape and others are blank.

Formally, δ:Q×Γk →Q×Γk× {L,R}k, wherek is the number of tapes.

δ(qi,a1, . . . ,ak) = (qj,b1, . . . ,bk,L,R, . . . ,L)

Theorem

Every multi-tape TM has an “equivalent” single-tape TM.

Proof idea:

I Keep a special marker # to separate tapes I Keep copy of alphabet to have different heads

I When you encounter # during simulation, shift cells to make space.

(23)

Multi-tape to single-tape TM

Definition

A multitape TMis a TM with several tapes, each having its own head for reading and writing. Input is on first tape and others are blank.

Formally, δ:Q×Γk →Q×Γk× {L,R}k, wherek is the number of tapes.

δ(qi,a1, . . . ,ak) = (qj,b1, . . . ,bk,L,R, . . . ,L)

Theorem

Every multi-tape TM has an “equivalent” single-tape TM.

Proof idea:

I Keep a special marker # to separate tapes

(24)

Non-deterministic TMs

Non-deterministic TMs

At any point in the computation, the TM may proceed according to several possibilities. Thus the transition function has the form:

δ :Q×Γ→2Q×Γ×{L,R}

Theorem

Every non-deterministic TM is equivalent to a deterministic TM. Proof idea:

1. View NTMN’s computation as a tree.

2. explore tree using bfs and for each node (i.e., config) encountered, check if it is accepting.

(25)

Non-deterministic TMs

Non-deterministic TMs

At any point in the computation, the TM may proceed according to several possibilities. Thus the transition function has the form:

δ :Q×Γ→2Q×Γ×{L,R}

Theorem

Every non-deterministic TM is equivalent to a deterministic TM.

Proof idea:

1. View NTMN’s computation as a tree.

2. explore tree using bfs and for each node (i.e., config) encountered, check if it is accepting.

(26)

Non-deterministic TMs

Non-deterministic TMs

At any point in the computation, the TM may proceed according to several possibilities. Thus the transition function has the form:

δ :Q×Γ→2Q×Γ×{L,R}

Theorem

Every non-deterministic TM is equivalent to a deterministic TM.

Proof idea:

1. View NTMN’s computation as a tree.

2. explore tree using bfs and for each node (i.e., config) encountered, check if it is accepting.

(27)

Non-deterministic TMs

Non-deterministic TMs

At any point in the computation, the TM may proceed according to several possibilities. Thus the transition function has the form:

δ :Q×Γ→2Q×Γ×{L,R}

Theorem

Every non-deterministic TM is equivalent to a deterministic TM.

Proof idea:

1. View NTMN’s computation as a tree.

using bfs and for each node (i.e., config) encountered, check if it is accepting.

(28)

Non-deterministic TMs

Non-deterministic TMs

At any point in the computation, the TM may proceed according to several possibilities. Thus the transition function has the form:

δ :Q×Γ→2Q×Γ×{L,R}

Theorem

Every non-deterministic TM is equivalent to a deterministic TM.

Proof idea:

1. View NTMN’s computation as a tree.

2. explore tree using bfs and for each node (i.e., config) encountered, check if it is accepting.

References

Related documents

I Assume that the tape of TM is one-way infinite and never attempts to move left off its left-end. I If w = ε, then use t instead

A languages is known as DSPACE(O(n)), if it is accepted using linear space on a Deterministic Turing machine. Clearly, DSPACE is a subset of NSPACE, but it is not known

A language is decidable (or recursive) if there is a Turing machine accepting it, which has the additional property that it halts on all possible inputs.. Every decidable language

cbna CS310 : Automata Theory 2019 Instructor: Ashutosh Gupta IITB, India 10.. CFGs

Don t bother going through all the client s overdue books, and don t consider any other rule about facilities... Has

cbna CS310 : Automata Theory 2019 Instructor: Ashutosh Gupta IITB, India 2..

If the machine is able to fool the interrogator to behave like a human, then that machine passes the Turing Test..

• “We need to be careful about what we wish for from a superhuman intelligence as we might get