7 Partc TM
7 Partc TM
Turing Machines
TMs
aa,R
ba,R
This TM when reading an a will move right one square stays in the
same start state. When it scans a b, it will change this symbol to an
a and go into the other state (accept state).
Examples
a b b # a b b X b b # a b b X
b b b # a b b
X
b b b # X b b X X b # X b b X
b X b # X b b
Overwrite X
Scan left, past # to X
Move one space right
Record symbol and overwrite X
Move right to #, when X encountered, move right one space
If symbols don’t match, reject
…
Examples
X
b X X # X X X
enters state r
Computation changes
Current state
Current head position
Tape contents
Configurations
Configuration
1011r0111
Means
State is r
Left-Hand-Side (LHS) is 1011
Right-Hand-Side (RHS) is 0111
Head is on RHS 0
Configurations
uarbv yields upacv if
ξ(r,b) = (p,c,L)
halting configurations
w0qacceptw1
w0qrejectw1
Accepting a language
M accepting 02^n
What is the language ?
Detailed example(M1 accepting 02^n)
TM for L(M1): Cross off every other zero
Adding two to a number in unary
Adding 1 to a Binary Number
Shift right machine
Shift right machine
Detailed Example
L = {anbncn | n>0}
On an input to a TM we may
accept
reject
loop (run for ever)
Not very practical: never know if TM will halt
Enumerable languages
Definition: A TM decides a language if it always
halts in an accept or reject state (that is, it never
loops). Such a TM is called a decider
Definition: A language is decidable if some TM
decides it
Some textbooks use recursive instead of decidable
Recursive Language: decided by an always-halting TM
Therefore, every decidable (or recursive) language
is (recursively) enumerable, but not the reverse!
NOTE: Recursively Enumerable (or Turing recognizable) means Turing machine does not necessarily halt. Recursive
(or decidable), on the other hand, means that the Turing machine always halts.
Decidable vs recognizable
Decidable (always halting TM)
Recursive
Computable
Solvable
Recognizable (recognize members only)
Recursively enumerable (RE)
Partially decidable
Semi decidable
Unrecognizable (can’t even recognize members reliably)
Not RE
Not partially decidable
Example of decidable language
given,
aabbbcccccc
Example of decidable language
given,
aabbbcccccc
aabbbcccccc
abbbcccccc
Example of decidable language
given,
aabbbcccccc
aabbbcccccc
abbbcccccc
abbbcccccc
Example of decidable language
given,
aabbbcccccc
aabbbcccccc
abbbcccccc
abbbcccccc
abbbccccc
Example of decidable language
given,
aabbbcccccc
aabbbcccccc
abbbcccccc
abbbcccccc
abbbccccc
abbbcccc
abbbccc
Example of decidable language
given,
aabbbcccccc
aabbbcccccc
abbbcccccc
abbbcccccc
abbbccccc
abbbcccc
abbbccc
abbbccc
bbbccc bbbcc bbbc bbb
TM: Variants
S simulates M
Simulating a Nondeterministic TM
1) Depth first search may continue forever, hence breadth first search.
2) Tape 1 contains the input and is never altered.
3) Tape 2 maintains a copy of N’s tape on some branch.
4) Tape 3 tracks D’s location in N’s nondeterministic computation tree.
Remarks
Informally
A recipe
A procedure
A computer program
Historically
Notion has long history in Mathematics (Al-khwarzmi),
but
Not precisely defined until 20th century
Informal notion rarely questioned, but are insufficient
Hilbert’s 10th problem
NPDA
NFA/DFA TM
Context-free
regular Recursively
enumerable
Context Sensitive
Chomsky hierarchy
Type-0 grammars (unrestricted grammars) include all formal grammars. They generate
exactly all languages that can be recognized by a Turing machine, called recursively
enumerable languages.
Type-1 grammars (context-sensitive grammars) generate the context-sensitive
languages. The languages described by these grammars are exactly all languages that
can be recognized by a linear bounded automaton (a nondeterministic Turing machine
whose tape is bounded by a constant times the length of the input.)
Type-2 grammars (context-free grammars) generate the context-free languages. These
languages are exactly all languages that can be recognized by a non-
deterministic pushdown automaton. Context-free languages are the theoretical basis for
the syntax of most programming languages.
Type-3 grammars (regular grammars) generate the regular languages. Regular
languages are commonly used to define search patterns and the lexical structure of
programming languages.
Note that the set of grammars corresponding to recursive languages is not a member of
this hierarchy.
Closures Of Languages
Language/Operation Union Intersection Complement Concatenation Kleen Reversal Intersection
e Star with Regular
Enumerable/decidable
languages
definition