National University of Sciences & Technology, Islamabad
Theory of automata
CS 301

Fall 2016
NFA AND KLEENES
THEOREM
Shakir Ullah Shah
a
PROOF 2 OF RULE 1, PART 3, THEOREM 6
Rule 1 states that there are FAs for the
languages cfw_a, cfw_b, and cfw_.
Proof:
Step 1: The above three languages can all be
accepted respectively by the NFAs below:
Ste
National University of Sciences & Technology, Islamabad
Theory of automata
CS 301

Fall 2016
Please NOTE:
Finite state Machine = FSM , Machine = M
Use state Elimination method to Write RE.
Answer:
NOTE: Anything from state 3 will go to trap.
Answer:
Answer:
Answer:
National University of Sciences & Technology, Islamabad
Theory of automata
CS 301

Fall 2016
Please NOTE:
Finite state Machine = FSM , Machine = M, Language of Machine = L (M)
Use state Elimination method to Write RE.
NOTE: Anything from state 3 will go to trap.
1. Use the state elimination method to convert the following DFA to a regular express
National University of Sciences & Technology, Islamabad
Theory of automata
CS 301

Fall 2016
Write the Regular Expressions of following languages. (Answer key)
There may be many solutions to one problem. Here you are given one of them.
1. (a + b )2 corresponds to the language cfw_aa, ab, ba, bb, that is the set of strings of length 2
over the alp
National University of Sciences & Technology, Islamabad
Theory of automata
CS 301

Fall 2016
Write the Regular Expressions of following languages.
1. _ corresponds to the language cfw_aa, ab, ba, bb, that is the set of strings of
length 2 over the alphabet cfw_a, b.
2. _ corresponds to the set of all strings over the alphabet cfw_a, b.
3. _ corre
National University of Sciences & Technology, Islamabad
Theory of automata
CS 301

Fall 2016
Kleenes
Theorem
Shakir Ullah Shah
Lecture 7
A
Proof of Part 3: Converting Regular Expressions into FAs
We prove this part by recursive definition and constructive
algorithm at the same time.
The set of regular expressions is defined by the following rules
National University of Sciences & Technology, Islamabad
Theory of automata
CS 301

Fall 2016
Transition Graphs (TG)
Shakir Ullah Shah
Lecture 6
a
FAST National University of Computer and Emerging Sciences, Peshawar Campus
Relaxing the Restriction on Inputs
The language accepted by this FA is L = cfw_baa
FAST National University of Computer and E
National University of Sciences & Technology, Islamabad
Theory of automata
CS 301

Fall 2016
Theory of Automata
Shakir Ullah Shah
LECTURE 5
FA AND THEIR
LANGUAGES
We will study FA from two different angles:
1. Given a language, can we build a machine for it?
2. Given a machine, can we deduce its language?
Note:
Every state has as many outgoing
National University of Sciences & Technology, Islamabad
Theory of automata
CS 301

Fall 2016
THEORY OF AUTOMATA
Shakir Ullah Shah
FAST National University of Computer and Emerging Sciences, Peshawar
LECTURE#1 RECAP
Definition of the Alphabet, string, word,
empty/Null String, Substring, Prefix, Suffix
Operations on String
Concatenation, length
National University of Sciences & Technology, Islamabad
Theory of automata
CS 301

Fall 2016
FINITE AUTOMATA WITH
OUTPUT
Shakir Ullah Shah
a
There are two type of machines:
Recognizer (Accept/reject)
Generator (output)
There are two types of machines
with output.
Moore machine and
Mealy machine
2
3
MOORE MACHINE
DEFINITION
Moore machine is
National University of Sciences & Technology, Islamabad
Theory of automata
CS 301

Fall 2016
MOORE=MEALY
SHAKIR ULLAH SHAH
MOORE MACHINE
APPLICATIONS OF
INCREMENTING AND
COMPLEMENTING
1s complementing and incrementing machines
MACHINES
which are basically Mealy machines are very much
helpful in computing.
The incrementing machine helps in build
National University of Sciences & Technology, Islamabad
Theory of automata
CS 301

Fall 2016
THEORY OF AUTOMATA
Shakir Ullah Shah
FAST National University of Computer and Emerging Sciences, Peshawar
RECOMMENDED
BOOK(S)
Text Book
Introduction to Computer Theory, by Daniel I. A Cohen,
John Wiley and Sons, Inc., Second Edition
Reference Book(s)
National University of Sciences & Technology, Islamabad
Theory of automata
CS 301

Fall 2016
THEOREM 7
for every NFA, there is some FA that accepts exactly
the same language.
Proof 1
NFA TO FA
Build an FA corresponding to the following NFA which
accepts the language of strings containing bb
NFA TO FA CONT.
EXAMPLE CONTINUED
New states after r
National University of Sciences & Technology, Islamabad
Theory of automata
CS 301

Fall 2016
THEORY OF AUTOMATA
Shakir Ullah Shah
Lecture 4
LANGUAGES ASSOCIATED
WITH REGULAR
EXPRESSIONS
REGULAR
LANGUAGES
The language generated by any regular
expression is called a regular language.
It is to be noted that if r1, r2 are regular
expressions, corre
National University of Sciences & Technology, Islamabad
Theory of automata
CS 301

Fall 2016
J 'Lcfw_Lll U: lcuuucu LU
*
r1 r2 r3 Example
Consider the following TG
To have single fnlal state: the above TG can be reduced to the following
To eliminate state 1 the above TG can be reduced to the following
< jgab+ba)aa+b)*(aaa+bba) ( )
Hence th