The Hong Kong University of Science and Technology
Theory of Computing
CSE 3721

Spring 2015
Lecture 9: ContextFree Languages
Contextfree grammar
is a language generator that is more powerful than regular
expressions.
important for parsing programs
Example:
= cfw_a, b
The language L represented by a(a b)b can be generated by
the following se
The Hong Kong University of Science and Technology
Theory of Computing
CSE 3721

Spring 2015
Lecture 4: Finite Automata
A finite automaton is a machine (controller) with only
a finite number of states.
It is the simplest and most restricted model of computers.
Such a controller is used in many electromechanical devices, e.g., automatic door, lift
The Hong Kong University of Science and Technology
Theory of Computing
CSE 3721

Spring 2015
Lecture 6: DFA = NFA = regular expressions
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 expression
Proof: We will prove the following: i) 1 2,
The Hong Kong University of Science and Technology
Theory of Computing
CSE 3721

Spring 2015
Lecture 3: Countability and Uncountability
How do we measure the sizes of infinite sets?
How can we compare their relative sizes?
The number of elements in a set A is called its cardinality, denoted A.
If A is a finite set, then A is a natural numbe
The Hong Kong University of Science and Technology
Theory of Computing
CSE 3721

Spring 2015
Lecture 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. Kleene star (L regular, then so is L),
4. Complemen
The Hong Kong University of Science and Technology
Theory of Computing
CSE 3721

Spring 2015
Lecture 12: 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 L1 and L2.
Rename the nonterminals, if necessa
The Hong Kong University of Science and Technology
Theory of Computing
CSE 3721

Spring 2015
Lecture 1: 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.
An element of a set can also be a set.
Ignore repetitions of elements in a set; ignore the
order of eleme
The Hong Kong University of Science and Technology
Theory of Computing
CSE 3721

Spring 2015
COMP 3721: Theory of Computation
Motivation and Overview
Theory of Computation
Mathematical study of computing machines, their
fundamental capabilities and their limitations.
Q1: What problems are solvable, in PRACTICE, by
computer and what problems are n
The Hong Kong University of Science and Technology
Theory of Computing
CSE 3721

Spring 2015
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 exactly one next state).
In an NFA,
some state may hav
The Hong Kong University of Science and Technology
Theory of Computing
CSE 3721

Spring 2015
Lecture 2: Languages and Regular Expressions
Basic concepts
Alphabet a finite set of symbols, .
word (or string) a finite sequence of symbols from
an alphabet.
Alphabet
Words
cfw_a, b, . . . , z man, abc, . . .
cfw_0, 1
000, 010101, . . .
cfw_#, $, a, b