Professional Documents
Culture Documents
Slide Automate
Slide Automate
Irum Feroz
Irum.feroz@superior.edu.pk
1
1. Introduction to Computer Theory, by Daniel
I. Cohen, John Wiley and Sons, Inc., 1991,
Second Edition
2. Introduction to Languages and Theory of
Computation, by J. C. Martin, McGraw Hill
Book Co., 1997, Second Edition
2
It is the plural of automaton, and it means
“something that works automatically”
3
4
Study of abstract computing devices, physical
processes ,theoretical machines or mathematical
model
A mathematical model is a description of a
system using mathematical concepts and
language.
Analyzing strength and weakness on various inputs
to get powerful machine
Goal: Limitations
Computability vs. Complexity
5
Every time we introduce a new machine, we
will learn its language; and every time we
develop a new language, we will try to find a
machine that corresponds to it.
In particular, the way we shall be studying
about computers is to build mathematical
models, called machines, and then to study
their limitations by analyzing the types of
inputs on which they can operate successfully.
The collection of these successful inputs is
called the language of the machine
Certain character strings DO, IF END …
Example ?
Informal Language??
9
Languages Structure
Alphabets
A finite non-empty set of symbols (letters),
is called an alphabet. It is denoted by Σ ( Greek
letter sigma).
Example:
Σ={a,b}
Σ={0,1}
10
Definition:
Concatenation of finite symbols from the
alphabet is called a string.
Example:
If Σ= {a,b} then
a, abab, aaabb, ababababababababab
11
Definition:
The length of string s, denoted by |s|, is the
number of letters in the string.
Example:
Σ={a,b}
s=ababa
|s|=5
12
Sometimes a string with no symbol at all is
used, denoted by (Capital Greek letter
Lambda) Λ, is called an empty string or null
string.
13
Definition:
Words are permissible strings belonging
to some language.
Example:
If Σ= {x} then a language L can be defined
as
L={xn : n=1,3,5,7…..} or L={x,xxx,xxxxx….}
Here x,xxx,… are the words of L
14
Example: The language {anbn }, of strings
defined over Σ={a,b}, as
{ab, aabb, aaabbb,aaaabbbb,…}
Example: The language {anbnan }, of strings
defined over Σ={a,b}, as
15
Set of words.
Set of Rules
English words ={All words in standard
dictionary}
16
The languages can be defined in different
ways , such as Descriptive definition,
Recursive definition, using Regular
Expressions(RE) and using Finite
Automaton(FA) etc.
17
Descriptive definition of language:
The language is defined, describing the
conditions imposed on its words.
18
Example 1:
The language L of strings of odd length,
defined over Σ={a}, can be written as
L={a, aaa, aaaaa,…..}
Example 2:
The language L of strings that does not start
with a, defined over Σ={a,b,c}, can be written
as
L={b, c, ba, bb, bc, ca, cb, cc, …}
19
Example 3:
The language L of strings of length 2,
defined over Σ={0,1,2}, can be written as
L={00, 01, 02,10, 11,12,20,21,22}
Example 4:
20
Example 5: The language EQUAL, of strings
with number of a’s equal to number of b’s,
defined over Σ={a,b}, can be written as
{Λ ,ab,aabb,abab,baba,abba,…}
Example 6: The language EVEN-EVEN, of
strings with even number of a’s and/or even
number of b’s, defined over Σ={a,b}, can be
written as
{Λ, aa, bb, aaaa,aabb,abab, abba, baab, baba,
bbaa, bbbb,…}
21
Example 7: The language INTEGER, of strings
defined over Σ={-,0,1,2,3,4,5,6,7,8,9}, can be
written as
INTEGER = {…,-2,-1,0,1,2,…}
Example 8: The language EVEN, of stings
defined over Σ={-,0,1,2,3,4,5,6,7,8,9}, can be
written as
EVEN = { …,-4,-2,0,2,4,…}
22
Definition:
The reverse of a string s denoted by Rev(s)
or sr, is obtained by writing the letters of s
in reverse order.
Example:
If s=abc is a string defined over Σ={a,b,c}
then Rev(s) or sr = cba
23
Example:
Σ= {B, aB, bab, d}
s=BaBbabBd
Rev(s)=dBbabBaB
24
PALINDROME:
The language consisting of Λ and the strings
s defined over Σ such that Rev(s)=s.
It is to be denoted that the words of
PALINDROME are called palindromes.
Example:For Σ={a,b},
PALINDROME={Λ , a, b, aa, bb, aaa, aba,
bab, bbb, ...}
25
Previously, we defined the languages:
• L1 = {Xn for n = 1, 2, 3, . . .}
• L2 = {Xn for n = 1, 3, 5, . . .}
• L2 = {Xn for n = 1, 4, 7,10 . . .}
*, + and ()
30
The notation x* can be used to define languages
by writing, say L = language (x*)
31
We can apply the Kleene star to the whole
string ab if we want:
(ab)* = Λ or ab or abab or ababab…
Observe that
(ab)* ≠ a*b*
because the language defined by the expression
on the left contains the word abab, whereas the
language defined by the expression on the
right does not. Prove it?
32
Given ∑ = {a, b}, define the language L that contains all
words of the form one a followed by some number of
b’s (maybe no b’s at all); that is
L = {a, ab, abb, abbb, abbbb, …}
Using the language-defining symbol, we may write
L = language (ab*)
33
language L1 = {x; xx; xxx; …}, we can write
R.E = language(xx*)
which means that each word of L1 must start with an x
followed by some (or no) x’s.
34
Given ∑ = {a, b}, define the language L that contains all words of
the form
L = language (ab*a)
35
Strings of a’s and b’s in which all the a’s (if any) come
before all the b’s(if any)?
∑=(a,b)
Language = {^ a b aa bb aab aabb … }
abab? baaaa ? bababa?
L = language (a*b*)
36
Let us introduce another use of the plus sign.
By the expression
x+y
where x and y are strings of characters from an
alphabet, we mean either x or y.
37
Consider the language L over the alphabet
Σ = {a, b, c}
L = {a; c; ab; cb; abb; cbb; abbb; cbbb; abbbb;
cbbbb; …}
In other words, all the words in T begin with
either an a or c and then are followed by some
number of b’s.
Using the above plus sign notation, we may
write this as
L= language((a+ c)b*)
38
Consider a finite language L that contains all
the strings of a’s and b’s of two exactly:
L = {aa, ab, ba, bb}
Thus, we may write
L = language((a+ b)(a + b))
39
Consider a finite language L that contains all
the strings of a’s and b’s of length three
exactly:
L = {aaa, aab, aba, abb, baa, bab, bba, bbb}
Thus, we may write
L = language((a+ b)(a + b)(a + b))
40
In general, if we want to refer to the set of all possible
strings of a’s and b’s of any length whatsoever, we
could write
language((a+ b)*)
41
Language having double 0
∑=(0,1)
L=(0+1)*00(0+1)*
42
all strings containing no more than three a's
=(a,b,c)
43
The set of regular expression is defined by
following rules
1. Every letter of and Λ is a regular expression
2. If r1 and r2 are regular expressions, then so are
(r1)
r1r2
r1+r2
r1*
3.Nothing else is a regular expression
Given = {a,b}
a* = {Λ, a,aa,aaa,aaa,aaaa,aaaaa, …}
ab* = {a, ab,abb,abbb,abbbb, …}
a+b = {a,b}
(ab)* = {Λ, ab, abab, ababab, …}
(a+b)* = {Λ, any string of as and bs}
(0 + 10*)
L = { 0, 1, 10, 100, 1000, 10000, … }
(0*10*)
L = {1, 01, 10, 010, 0010, …}
(a+b)*
Set of strings of a’s and b’s of any length
including the null string.
So L = { ^, a, b, aa , ab , bb , ba, aaa…….}
46
(a+b)*abb
Set of strings of a’s and b’s ending with the string abb.
So L = {abb, aabb, babb, aaabb, ababb, …………..}
(11)*
Set of strings consisting of even number of 1’s
So L= {^, 11, 1111, 111111, ……….}
(aa)*(bb)*b
Set of strings consisting of even number of a’s followed
by odd number of b’s
so L = {b, aab, aabbb, aabbbbb, aaaab, aaaabbb,..}
47
what languages do they generate
a (b + a)*
bb(a+b)
(a+b)(a+b)(a+b)
(a+b)*ba
(a+b)*a(a+b)*
(a+b)*aa(a+b)*
Write RE for the languages over the ={a,b}
consisting of words that contain at least one a and
at least one b
(a+b)*a(a+b)*b(a+b)*
(a+b)*a(a+b)*b(a+b)*+(a+b)*b(a+b)*a(a+b)*
Set consisting of even number of 1’s including
empty string
L= {^, 11, 1111, 111111, ……….}
R.E = (11)*
50
Set of strings consisting of even number of a’s
followed by odd number of b’s
R.E = (aa)*(bb)*b
51
Any language that can be represented by a regular
expression is called a regular language
54
Power is Linear
RE for an where n>=3
aaaa*= aaa*a
RE for a2n where n=0 … n
(aa)*
RE for a2n+1 where n=0 … n
a(aa)*
55
Power is non linear
an2
56
Definition
Two regular expressions are said to be
equivalent if they generate the same language.
Example
Consider the following regular expressions
r1 = (a + b)* (aa + bb)
r2 = (a + b)*aa + ( a + b)*bb then both regular
expressions define the language of strings
ending in aa or bb
The language of all words that have at least two a’s can
be defined by the expression:
(a + b)*a(a + b)*a(a + b)*