COMP272: Theory of Computation
Unit 1: Motivation and Overview
Theory of Computation
Mathematical study of computing machines, their
fundamental capabilities and their limitations.
Q1: What problems a
14: Pumping Theorem for CFLs
The idea behind the pumping theorem for CF languages
is similar to the pumping theorem for regular languages.
If the parse tree of a string is deep enough, then at least
o
15. Turing Machines
Outline
(Deterministic) Turing Machines
How TMs work
How TMs are specied
Computations for TMs
1
Turing Machines
Pushdown automata are too restrictive (uses stack) to serve
as
16. Turing Machines as Language Recognizers
Hereafter, we shall ssume that the initial conguration of M on
input w is (s, w).
Let M = (K, , , s, H ) be a Turing Machine such that
H = cfw_y, n
where y
17. Extensions of TM and Church-Turing Thesis
Extensions of TM
1. allow both write and move in one step
2. multiple tapes
3. two-way innite tape
4. nondeterminism
Theorem 1 The operation of a machine
Closure properties of recursive and r.e. languages
Theorem 1 The class of recursive languages is closed under
1. complementation
2. union
3. concatenation
4. Kleene star (proof similar to (3)
5. inter
18. Universal Turing Machines
So far, each Turing machine appears to be specialized at
solving one particular problem.
Can we program a Turing machine to obtain a generalpurpose programmable Turing
19. Decidable problems
An example of decision problems:
Does a given polynomial p over variable x have an integral root?
The equivalent language membership problem:
D = cfw_p|p is a polynomial over x
20. Undecidable problems
Reduction is the primary method for proving that a problem
is computationally undecidable.
Reducing a problem A to problem B means a solution for
problem B can be used to solv
8c: Decidable problems of regular languages
The following decision problems are decidable (solvable),
i.e., there exist algorithms for solving these problems.
1. Given a FA M and a string w, does M ac
14b: Decidable problems of context-free languages
The following decision problems about context-free grammar are decidable, i.e., there exist algorithms for solving
them.
1. Given a CFG G and a string
13: Closure Properties of CFLs
Theorem 1 CFLs are closed under
1. union,
2. concatenation,
3. Kleene Star.
Proof
Let G1 = (V1, 1, R1, S1 ), and G2 = (V2, 2, R2, S2 ) be the
two CFG generating the CFLs
12: PA CFG
Theorem 1 If a language is context-free, then it is accepted
by a PA.
The proof is a constructive proof. We rst sketch the idea. We
construct a PA from the given CFG as follows:
1. Push the
Lecture 2: Sets, Relations, and Functions (a
Review)
Sets
A set is a collection of objects.
Example: L = cfw_a, b, c, d is a set of four elements.
a L denotes a is in L, and z L denotes z is not
in
Lecture 3: Languages and Regular Expressions
Basic concepts
Alphabet a nite set of symbols, .
word (or string) a nite sequence of symbols from
an alphabet.
Alphabet
Words
cfw_a, b, . . . , z man, ab
Lecture 4: Finite Automata
A nite automaton is a machine (controller) with only
a nite number of states.
It is the simplest and most restricted model of a computer.
Such a controller is used in many e
Lecture 5: Nondeterministic Finite Automata
In a DFA,
each symbol read causes a transition to the next
state, which is completely determined by the current state and current symbol (i.e., there is e
Lecture 6: The fundamental theorem
Let L . Then the following three statements are equivalent.
1. L is accepted by some DFA.
2. L is accepted by some NFA.
3. L can be represented by a regular expressi
7: Properties of regular languages
Theorem 1 The set of regular languages are closed
under
1. Concatenation (L1 and L2 regular, then so is L1L2),
2. Union (L1 and L2 regular, then so is L1L2),
3. Klee
8: Proving that a language is not regular
Example: L = cfw_0n1n|n 0 is not a regular language.
Intuitively, this language L is not regular because any
machine that can recognize L must remember how m
Lecture 9: Countability and Uncountability
How do we measure the sizes of innite sets?
How can we compare their relative sizes?
The number of elements in a set A is called its cardinality, denoted |A
10: Context-Free Languages
Context-free grammars
is a language generator that is more powerful than regular
expressions.
important for parsing programs
Example:
= cfw_a, b
The language L represente
11: Pushdown Automata
Every regular language is a CFL.
But some CFLs are nonregular.
Since FA Regular languages, some CFLs cannot be recognized by any FA.
Examples of CFLs that are nonregular:
cfw_ a
8b: State Minimization
One obvious way to reduce the number of states is to
eliminate any states that are not reachable from the start
state.
Hereafter, we shall assume that all states in the given
DF