ThAlgo 02 TM
ThAlgo 02 TM
• 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
𝛿 ( 𝑞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
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)
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
∗ _ 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
∗ _ 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
_______ 1______ 0 0 0_ _ _ _
00_____ 0 0 1_ _ _ _
11101____ 01_____
10_____
Enumeration of languages
Enumerators run , see if accepts/rejects
𝑥 ∈ 𝐿, 𝑥 ∉ 𝐿
𝑥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