Download as pdf or txt
Download as pdf or txt
You are on page 1of 23

1

Lahore Garrison University


CSC353-Theory of Automata
Week-2 Lecture-4
Semester-4 Fall 2022
:
3

► Formal vs Informal

► Informal language / Semantic language (English language)


► Concerned with rules and meanings .
► Example:
► Work wokr

Lahore Garrison University


4

► Formal language/Syntactic language


► Concerned with only rules.
► Example:
► Make a language that start with w and end with o.
► Wkro work

Lahore Garrison University


5
Preamble of lecture

► Some main definition


► Practice questions

Lahore Garrison University


6
Lecture Outcomes

► Understanding related
► Languages

Lahore Garrison University


7
Defining Languages Continued…

Recursive definition of languages


► It is one of the language defining methods
1.
► In this method, we simply describe the language with three steps/rules
2.
► 1. First, we specify some basic objects in the set. The number of basic objects
3. specified must be finite.
► 2. Second, we give a finite number of rules for constructing more objects in the
set from the ones we already know.
► 3. Third, we declare that no objects except those constructed in this way are
allowed in the set.
The following three steps are used in recursive definition
• Some basic words are specified in the language.
• Rules for constructing more words are defined in the language.
• No strings except those constructed in above, are allowed to be in the
language.
8
Example

► Defining language of INTEGER


Step 1:
1 is in INTEGER.
Step 2:
If x is in INTEGER then x+1 and x-1 are also in INTEGER.
Step 3:
No strings except those constructed in above, are allowed to be in
INTEGER.
Example: Recursive Definition for Positive Even Numbers / Positive Even

Integers P-Even = {2,4,6,8,10,..}

Rule 1: 2 is in P-EVEN.
Rule 2: If x is in P-EVEN, then so is x + 2.
Rule 3: The only elements in the set P-EVEN are those that can be produced
from the two rules above.
9

► How do automata accept or reject the input?


► How can automata know given string is valid or not ?

► S={a,b} only word can be accepted that starts from a and end with a .
► A,b,ab,abba,abbb,aabb,…………..

► A,abba

Lahore Garrison University


10

► S={a,b} only word can be accepted that starts from b and end with b that length will be 2.
► A,b,bb,bab,ab,abba,abbb,aabb,…………..

► B,bb,bab

► Bab
► Rev(bab)

Lahore Garrison University


11
Example

► Defining language of EVEN


Step 1:
2 is in EVEN.
Step 2:
If x is in EVEN then x+2 and x-2 are also in EVEN.
Step 3:

No strings except those constructed in above, are allowed to be in EVEN.


14
Defining the language
defined over Σ = {a,b}
PALINDROME,
Reverse(X) = X
12321=12321
121=121

Lahore Garrison University


15

Step 1:
Λ, a, and b are in PALINDROME.
Step 2:
If w ∈ PALINDROME, then so are awa and bwb.

Step 3:No other string is in PALINDROME


unless it can be produced by rules 1 and 2.
Defining the language {anbn }, n=1,2,3,… , of 16
strings defined over Σ={a,b}

Lahore Garrison University


17

Step 1:
ab is in {anbn}
Step 2:
if x is in {anbn}, then axb is in {anbn}
Step 3:

No strings except those constructed in above, are allowed to be in {anbn}


18
Defining the language L, of strings beginning and
ending in same letters , defined over Σ={a, b}

Step 1:
a and b are in L
Step 2:
(a)s(a) and (b)s(b) are also in L, where s belongs to Σ*
Step 3:

No strings except those constructed in above, are allowed to be in L


19
Defining the language L, of strings containing
aa
or bb , defined over Σ={a,
b}
Step 1:
aa and bb are in L
Step 2:
s(aa)s and s(bb)s are also in L, where s belongs to Σ*
Step 3:

No strings except those constructed in above, are allowed to be in L


Descriptive Definition

Descriptive Definition.
It is one of the language defining methods
In this method, we simply describe the condition imposed on
its strings/words
Example:

L1 = {any finite string of letters that does not start with letter 0}

Example:

L1 = {set of all strings of letters that starts with a and ends with a}
Define a Palindrome language with Descriptive Definition

Palindrome = {^, and all strings x such that reverse (x) = x }


e.g. Palidrome = { a, b, aa, bb, aaa, aba ... }
20

Q&A

Lahore Garrison University


21
References

Lahore Garrison University

You might also like