0% found this document useful (0 votes)
11 views

ThAlgo 02 TM

The document provides an overview of Turing Machines, including their definition, configurations, and types such as deterministic and nondeterministic machines. It discusses the capabilities of Turing Machines, including their ability to recognize and decide languages, as well as the concept of enumerators and the Church-Turing thesis. Various improvements and variants of Turing Machines, such as multi-tape and nondeterministic models, are also explored.

Uploaded by

ngn.tr80
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

ThAlgo 02 TM

The document provides an overview of Turing Machines, including their definition, configurations, and types such as deterministic and nondeterministic machines. It discusses the capabilities of Turing Machines, including their ability to recognize and decide languages, as well as the concept of enumerators and the Church-Turing thesis. Various improvements and variants of Turing Machines, such as multi-tape and nondeterministic models, are also explored.

Uploaded by

ngn.tr80
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 55

Turing Machines

• Definition
• Examples
𝐿= {0 ∨𝑛 ≥ 0 }
𝑛
2
δ (q₁ , ⎵) (qreject , ⎵ , R)
(q₂ , ⎵ , R)
=
δ (q₁ , 0) =

δ (q₂ , ⎵) (qaccept , ⎵ , R)
δ (q₁ , x) = (qreject , x , R)
=
δ (q₂ , 0) = (q₃ , x , R)

δ (q₃ , ⎵) (q₅ , ⎵ , L)
δ (q₂ , x) = (q₂ , x , R)
=
δ (q₃ , 0) = (q₄ , 0 , R)
δ (q₃ , x) = (q₃ , x , R)

δ (q₅ , x) = (q₅ , x , L)
Build a TM that recognizes

Idea: Compare the left and right sides symbol-by-symbol,


crossing them out afterwards
Build a TM that recognizes
1 0 0 1 # 1 0 0 1 _ _
Build a TM that recognizes
x 0 0 1 # 1 0 0 1 _ _
Build a TM that recognizes
x 0 0 1 # 1 0 0 1 _ _
Build a TM that recognizes
x 0 0 1 # 1 0 0 1 _ _
Build a TM that recognizes
x 0 0 1 # x 0 0 1 _ _
Build a TM that recognizes
x 0 0 1 # x 0 0 1 _ _

𝛿 ( 𝑞1 , _ ) =( 𝑞 𝑟𝑒𝑗𝑒𝑐𝑡 , 𝑅 )
Build a TM that recognizes
x 0 0 1 # x 0 0 1 _ _
Build a TM that recognizes
x 0 0 1 # x 0 0 1 _ _
Build a TM that recognizes
x x 0 1 # x 0 0 1 _ _
Build a TM that recognizes
x x 0 1 # x 0 0 1 _ _
Build a TM that recognizes
x x 0 1 # x 0 0 1 _ _
Build a TM that recognizes
x x 0 1 # x x 0 1 _ _
Build a TM that recognizes
x x 0 1 # x x 0 1 _ _
Build a TM that recognizes
x x x x # x x x x _ _
Build a TM that recognizes
x x x x # x x x x _ _
Build a TM that recognizes
x x x x # x x x x _ _
Build a TM that recognizes
x x x x # x x x x _ _
Build a TM that recognizes
x x x x # x x x x _ _
Build a TM that recognizes
x x x x # x x x x _ _
Build a TM that recognizes
x x x x # x x x x _ _

1 0 0 1 # 1 0 0 1 1 _

x x x x # x x x x 1 _
Build a TM that recognizes

1 0 x x # 1 0 0 x x _

x x x 1 # x x x x 1 _
Some important notions
• Turing Machine
• Description of a TM
• Configuration of TM
• Halting of TM
• Recognition and Deciding
• Recursively enumerable and Recursive languages
Turing machines

• A 7-tuple (Q, Σ, Γ, δ, q0, qaccept, qreject)


• For simplicity, we can omit qreject and the corresponding arrows
Describing Turing machines
• Formal description
• Defines the elements of the tuple , either by listing them or by a state
transition diagram
• Implementation description
• Describes in English prose what the Turing machine does
• Where it moves head, what gets written on the tape, etc.
• Details of states and transition function are omitted
• High-level description
• Describes an algorithm, ignoring the implementation details
• Details of how the machine manages its tape or head are omitted
Configuration of TM
• TM current state
• Contents of the tape
• Position of the head
Configuration of TM
• Given input, the initial configuration is:

• If , then the configuration after the 1st step is:

• To denote that cfg is directly followed the cfg we write:

• A typical workflow of a TM:

• To denote that cfg is indirectly followed the cfg we write:


Halting of a TM
A run of Turing machine on word has 3 possible outcomes:

• TM eventually arrives at the state

• TM eventually arrives at the state

• TM loops eternally and never stops

or maybe
Languages recognized / decided by
TM
Languages recognized / decided by
TM

or is undefined
“Improvements” for TM
• Additional transition
• Two-side-infinite tape
• Multiple tapes
• Nondeterministic behavior
Variants of TM
• Allowed transitions {L,R} vs {L,N,R}
• N transition can be replaced by two transitions (R,L)
Variants of TM
• Allowed transitions {L,R} vs {L,N,R}
• N transition can be replaced by two transitions (R,L)

• Doubly-infinite tape vs singly-infinite tape

a b c a b _ _ _ …

… _ _ a b c a b _ _ _ …
Every (doubly-infinite) TM can be simulated by a TM that
never moves its head to the left of the starting position

• Add a special symbol


• When starting, TM writes in the first cell and shifts all other content
to the right, then goes to the first position and simulates
• If finds itself on , then insert _
a b c a b _ _ _ …
and shift all input to the right,
then continue simulating
∗ a b c a b _ _ …
∗ x b a a b _ _ …

∗ _ x b a a b _ … ∗ _ x b a a b _ …
Every (doubly-infinite) TM can be simulated by a TM that
never moves its head to the left of the starting position

• Add a special symbol


• When starting, TM writes in the first cell and shifts all other content
to the right, then goes to the first position and simulates
• If finds itself on , then insert _
a b c a b _ _ _ …
and shift all input to the right,
then continue simulating
∗ x b a a b _ _ _ a b _ _ _
∗ a b c a b _ _ …

∗ _ x b a a b _ _ _ a b …_ …
∗ a x b a a b a …

∗ _ x b a a b _ _ a b _ …_ …
Simulating a doubly-infinite tape by
a
singly-infinite one
• Note: to shift all content to the right, the TM has to know where the
content ends (and the infinite sequence of _ _ _ _ … starts)
• This can be solved by never writing _ on the tape but some other
symbol that is treated like _
∗x b a a b _ _ … ∗x b a a b _ _ c c b b _ _ …

∗ x b a a b _ …
∗_ x b a a b _ c c b b _ _ … Wrong

∗x b a a b c c b b _ _ … ∗ _ x b a a b _ _ c c b b _ _ … Right
Multi-tape TM 𝑞0
• Has multiple tapes and heads
• The additional tapes are empty at … ¿_ a b c _ _ …

the start
… ¿_ _ _ _ _ _ …
• TM sees all the symbols under the
heads simultaneously and can … ¿_ _ _ _ _ _ …
move the heads independently
… ¿_ _ _ _ _ _ …
Multi-tape TM 𝑞9
• Has multiple tapes and heads
• The additional tapes are empty at … ¿_ a b c _ _ …

the start
… ¿_ a _ _ _ _ …
• TM sees all the symbols under the
heads simultaneously and can … ¿_ _ _ _ _ _ …
move the heads independently
… ¿_ c _ _ _ _ …
Multi-tape TM 𝑞4
• Has multiple tapes and heads
• The additional tapes are empty at … ¿_ a b c d _ …

the start
… ¿_ _ a a _ _ …
• TM sees all the symbols under the
heads simultaneously and can … ¿d a 1 _ _ _ …
move the heads independently
… ¿_ 1 1 0 _ _ …
Multi-tape TM
• Every -tape TM can be simulated with a 1-tape TM
Nondeterministic TM
• Similarly, as deterministic vs nondeterministic finite automata
• At any point in a computation, the machine may proceed according to
several possibilities

• If any branch of the computation leads to the accept state, the


machine accepts its input
Nondeterministic TM
• Every nondeterministic Turing machine has an equivalent
deterministic Turing machine.
0______ 11_____

_______ 1______ 0 0 0_ _ _ _
00_____ 0 0 1_ _ _ _
11101____ 01_____
10_____
Enumeration of languages
Enumerators run , see if accepts/rejects
𝑥 ∈ 𝐿, 𝑥 ∉ 𝐿

• Loosely defined, an enumerator


is a Turing machine with an
attached printer. The Turing
machine can use that printer as
an output device to print strings.
Every time the Turing machine
wants to add a string to the list,
it sends the string to the printer.

𝑥1 ¿ 𝑥 2 ¿ 𝑥 3 ¿ … ¿

𝐿= { 𝑥 1 , 𝑥 2 , 𝑥 3 , … }
Enumerators
or is undefined
A language is Turing-recognizable
if and only if
some enumerator enumerates it.
Church-Turing thesis
• Definition of algorithm / computation
• Several different models of computation / algoritms
• Turing machine (one-tape/multi-tape, deterministic/nondeterministic)
• Lambda calculus
• Markov’s normal algorithms
• Programming languages (C++, C#, Python, Java, Pascal, LISP, etc.)
• …
• All these models turn out to be equivalent
• Algorithms in one model can be simulated in other models
• CT thesis: a function on the natural numbers can be calculated by an effective method if
and only if it is computable by a Turing machine

You might also like