© All Rights Reserved

135 views

© All Rights Reserved

- Advanced Regex Tutorial—Regex Syntax
- Regex Quick Syntax Reference - Zsolt Nagy
- Regular Expressions
- Class_ Regexp (Ruby 2.1
- Perl Regex
- PDF8
- Hydra UserManual
- as3_devguide
- HP a-MSR Router Series QoS Command Reference
- 06-UsingStandardCheckpoints
- I Love Ruby 2015
- Grep Command
- 0310.pdf
- Regular Expression
- Py Regex Sample
- 245-2012
- Apr02_JohnZ.txt
- Ch 3 Characters & String
- 3_MapfileETHEX_10-11
- Php in Hindi

You are on page 1of 18

definition of languages, INTEGER, EVEN,

factorial, PALINDROME, {anbn}, languages of

strings (i) ending in a, (ii) beginning and ending

in same letters, (iii) containing aa or bb

(iv)containing exactly aa,

Task

Q)

1) Let S={ab, bb} and T={ab, bb, bbbb} Show

that S* = T* [Hint S* T* and T* S*]

2) Let S={ab, bb} and T={ab, bb, bbb} Show that

S* T* But S* T*

Solution: Since S T , so every string belonging

to S* , also belongs to T* but bbb is a string

belongs to T* but does not belong to S*.

abbabaabab and baabbbabbaabb in S*? Does any word

in S* have odd number of bs?

Solution: since abbabaabab can be grouped as

(a)(bb)(abaab)ab , which shows that the last member of

the group does not belong to S, so abbabaabab is not in

S*, while baabbbabbaabb can not be grouped as

members of S, hence baabbbabbaabb is not in S*. Since

each string in S has even number of bs so there is no

possiblity of any string with odd number of bs to be in

S*.

3

Task

Q1)Is there any case when S+ contains ? If

yes then justify your answer.

Solution: consider S={,a} then

S+ ={, a, aa, aaa, }

Here is in S+ as member of S. Thus will

be in S+ , in this case.

i. (S+)*=(S*)*

Solution: In general is not in S+ , while

does belong to S*. Obviously will now be

in (S+)*, while (S*)* and S* generate the

same set of strings. Hence (S+)*=(S*)*.

Q2) continued

ii) (S+)+=S+

Solution: since S+ generates all possible

strings that can be obtained by

concatenating the strings of S, so (S+)+

generates all possible strings that can be

obtained by concatenating the strings of

S+ , will not generate any new string.

Hence (S+)+=S+

6

Q2) continued

iii) Is (S*)+=(S+)*

Solution: since belongs to S* ,so will

belong to (S*)+ as member of S* .Moreover

may not belong to S+, in general, while

will automatically belong to (S+)*.

Hence (S*)+=(S+)*

Regular Expression

As discussed earlier that a* generates

, a, aa, aaa,

and a+ generates a, aa, aaa, aaaa, , so the

language L1 = {, a, aa, aaa, } and

L2 = {a, aa, aaa, aaaa, } can simply be

expressed by a* and a+, respectively.

a* and a+ are called the regular expressions

(RE) for L1 and L2 respectively.

Note: a+, aa* and a*a generate L2.

8

Expression(RE)

Step 1: Every letter of including is a

regular expression.

Step 2: If r1 and r2 are regular expressions then

1.(r1)

2.r1 r2

3.r1 + r2 and

4. r1*

are also regular expressions.

Step 3: Nothing else is a regular expression.

Method 3 (Regular Expressions)

Consider the language L={, x, xx, xxx,}

of strings, defined over = {x}.

We can write this language as the Kleene star

closure of alphabet or L=*={x}*

this language can also be expressed by the

regular expression x*.

Similarly the language L={x, xx, xxx,},

defined over = {x}, can be expressed by

the regular expression x+.

10

of all possible strings, defined over

= {a, b}. This language can also be

expressed by the regular expression

(a + b)*.

Now consider another language L, of strings

having exactly double a, defined over

= {a, b}, then its regular expression may

be

b*aab*

11

length, defined over = {a, b}, then its

regular expression may be

((a+b)(a+b))*

Now consider another language L, of odd

length, defined over = {a, b}, then its

regular expression may be

(a+b)((a+b)(a+b))* or

((a+b)(a+b))*(a+b)

12

Remark

It may be noted that a language may be

expressed by more than one regular

expressions, while given a regular expression

there exist a unique language generated by that

regular expression.

13

Example:

Consider the language, defined over

={a , b} of words having at least one a,

may be expressed by a regular expression

(a+b)*a(a+b)*.

Consider the language, defined over

= {a, b} of words having at least one a

and one b, may be expressed by a regular

expression

(a+b)*a(a+b)*b(a+b)*+ (a+b)*b(a+b)*a(a+b)*. 14

={a, b}, of words starting with double a

and ending in double b then its regular

expression may be aa(a+b)*bb

Consider the language, defined over

={a, b} of words starting with a and

ending in b OR starting with b and ending

in a, then its regular expression may be

a(a+b)*b+b(a+b)*a

15

TASK

Consider the language, defined over

={a, b} of words beginning with a, then

its regular expression may be a(a+b)*

Consider the language, defined over

={a, b} of words beginning and ending

in same letter, then its regular expression

may be (a+b)+a(a+b)*a+b(a+b)*b

16

TASK

Consider the language, defined over

={a, b} of words ending in b, then its

regular expression may be (a+b)*b.

Consider the language, defined over

={a, b} of words not ending in a, then its

regular expression may be (a+b)*b + . It is to

be noted that this language may also be

expressed by ((a+b)*b)*.

17

SummingUP Lecture 3

RE, Recursive definition of RE, defining

languages by RE, { x}*, { x}+, {a+b}*,

Language of strings having exactly one aa,

Language of strings of even length, Language

of strings of odd length, RE defines unique

language (as Remark), Language of strings

having at least one a, Language of strings

havgin at least one a and one b, Language of

strings starting with aa and ending in bb,

Language of strings starting with and ending

in different letters.

18

- Advanced Regex Tutorial—Regex SyntaxUploaded byharisaryono
- Regex Quick Syntax Reference - Zsolt NagyUploaded byL
- Regular ExpressionsUploaded byvcgundi
- Class_ Regexp (Ruby 2.1Uploaded bylilibethlelahel
- Perl RegexUploaded byGobara Dhan
- PDF8Uploaded byAndré Lucas Rocha De Melo
- Hydra UserManualUploaded byjose osvaldo martins
- as3_devguideUploaded byRaul Nascimento
- HP a-MSR Router Series QoS Command ReferenceUploaded byRubens Bezerra
- 06-UsingStandardCheckpointsUploaded byaustinfru
- I Love Ruby 2015Uploaded bySugeng Fajarianto
- Grep CommandUploaded byskajhkdhsa88dfd
- 0310.pdfUploaded byjivasumana
- Regular ExpressionUploaded byIke Cyril
- Py Regex SampleUploaded byabbey
- 245-2012Uploaded byVera Gaspar
- Apr02_JohnZ.txtUploaded bysaumitra2
- Ch 3 Characters & StringUploaded byAnamika Raj
- 3_MapfileETHEX_10-11Uploaded byRudy
- Php in HindiUploaded byRitesh Bagwale
- Gsw document keyword replaceUploaded byuniqueh-1
- Chapter 3 DialogsUploaded byy2chong
- r_basicsUploaded byAnonymous d70CGo
- Python Basics Cheat Sheet 1Uploaded bysrikanth patil
- OOP Lab 03Uploaded byIshfaq Ahmad
- Linux Essentials__The LPI Introductory Programme7-8.pdfUploaded byFrancisco CM
- Lesson 6Uploaded byArunkumar Panneerselvam
- C++ in Short by HassanUploaded byFEALABREPORTS
- M2-R3[1]Uploaded byIas Aspirant Abhi
- mp1Uploaded byVienNgocQuang

- The Hizbul Bahr - ChillahUploaded bymujzoob
- WDD_lec_04Uploaded byAtif Khan
- Fall 2015_CS508_2Uploaded byAtif Khan
- wpfcheatsheetUploaded byTechGuyOnline
- Building AguiUploaded byDeepak Malusare
- FinalProjectGuide-F13Uploaded byAtif Khan
- SRS Detail ExplainationUploaded byAtif Khan
- Spam FilterUploaded byAtif Khan
- FinalProjectGuide-Fall08Uploaded byAtif Khan
- Design Detail ExplainationUploaded byAtif Khan
- FinalProjectGuide-SP14Uploaded byAtif Khan
- cpts322-srs-v1Uploaded by10conga
- Spam FilterUploaded byAtif Khan
- ik_thesisUploaded byAtif Khan
- Ug Projects 2013Uploaded byAtif Khan
- Window Builder TutorialUploaded byBertty Contreras Rojas
- Lesson 2UAFUploaded bytariqravian
- SOPs Regarding Participating in Team Viewer Meeting SessionUploaded byAtif Khan
- exp86dccccUploaded byAtif Khan
- Program 1 - 1s Complement of 8-Bit NumberUploaded byMohit Verma
- TwosComp.pptUploaded byAtif Khan
- STA301_LEC11Uploaded byAtif Khan
- STA301_LEC19Uploaded byAtif Khan
- STA301_LEC18Uploaded byAtif Khan
- STA301_LEC23Uploaded byAtif Khan
- STA301_LEC01Uploaded byAtif Khan

- Brieftrouble Troubleshooting GuideUploaded byramesh2440
- EDI in ActionUploaded byGaurav Kumar
- Arduino Nano FixUploaded byJhony Tilano Zerpa
- Module B Exercise > ModB_QB09_engUploaded byapi-3812894
- Trial CRUD(Doc)Uploaded byJimmy Duran
- Multi Document Text Summarization using Backpropagation NetworkUploaded byAnonymous kw8Yrp0R5r
- AIM Vs OUMUploaded bygangwar18
- LTE KPI-Integrity.pdfUploaded byAnonymous bVe5uhyrlk
- Lesson5 Icons&ShorcutsUploaded byLivadari Ion
- Spring Interview QuestionsUploaded bySaidulu Rampe
- Functional LocationUploaded bySrinivasa Reddy
- Matrix Method for Analysis of Hydraulic NetworksUploaded byJose2806
- Leaky BucketUploaded bykamalkaur08
- OrganizationUploaded byReiche Gomez
- RegisterUploaded byAhmar Hayat Khan
- A Function/Artifact and Time/Incident Model of Complex Information Systems Michal WoskoUploaded bygeppe11
- (videogame) Rendering 102Uploaded byc0de517e.blogspot.com
- ReviewUploaded byMaria
- Data Integrator - Product Document Map [Ingles 4 pag.].pdfUploaded bytenaviso
- Ms. AccessUploaded byKhalidHassan
- Microsoft Visual C++Uploaded bypeppe
- Lakes Wrplot View Release NotesUploaded byAdrian Guerra Medrano
- ITC16 (Discrete Structures)Uploaded byMELJUN CORTES, MBA,MPA
- Portable Executable File FormatUploaded bydomeleu
- Intorductory Statistics, Chapter 1- Prem MannUploaded byKazi93_thefat
- 1st Grade Entrance ExamUploaded bysadorzon
- Intro Ch 01BUploaded byapi-3831049
- System Platform 2017.pptxUploaded bynew2track
- DtmUploaded byAnthony D Papousek
- Term Project - Introduction to Company-InfosysUploaded bySheetal Harrison