+ All Categories
Home > Documents > Lecture # 8

Lecture # 8

Date post: 21-Mar-2016
Category:
Upload: december
View: 25 times
Download: 1 times
Share this document with a friend
Description:
Lecture # 8. (Transition Graphs). Example. Consider the language L of strings, defined over Σ ={a, b}, having (containing) triple a or triple b. The language L may be expressed by RE ( a+b )* ( aaa + bbb ) ( a+b )* This language may be accepted by the following TG. - PowerPoint PPT Presentation
Popular Tags:
31
Lecture # 8 Lecture # 8 (Transition Graphs) (Transition Graphs)
Transcript
Page 1: Lecture # 8

Lecture # 8Lecture # 8

(Transition Graphs)(Transition Graphs)

Page 2: Lecture # 8

Example Example

Consider the language L of strings, defined Consider the language L of strings, defined over over ΣΣ={a, b}, ={a, b}, having (containing) having (containing) triple a or triple b. triple a or triple b.

The language L may be expressed by REThe language L may be expressed by RE(a+b)* (aaa + bbb) (a+b)*(a+b)* (aaa + bbb) (a+b)*

This language may be accepted by the This language may be accepted by the following TGfollowing TG

Page 3: Lecture # 8

Example Continued … Example Continued …

Page 4: Lecture # 8

OR OR

Page 5: Lecture # 8

OR OR

Page 6: Lecture # 8

Example Example Consider the language L of strings, defined Consider the language L of strings, defined

over over ΣΣ = {a, b}, = {a, b}, beginning and ending in beginning and ending in different lettersdifferent letters..

The language L may be expressed by RE The language L may be expressed by RE

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

The language L may be accepted by the The language L may be accepted by the following TG following TG

Page 7: Lecture # 8

Example continued … Example continued …

Page 8: Lecture # 8

Example Example Consider the Language L of strings Consider the Language L of strings of of

length two or morelength two or more, defined over , defined over ΣΣ = {a, = {a, b}, b}, beginning with and ending in same beginning with and ending in same letters. letters.

The language L may be expressed by the The language L may be expressed by the following regular expression following regular expression

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

This language may be accepted by the This language may be accepted by the following TG following TG

Page 9: Lecture # 8

Example Continued … Example Continued …

Page 10: Lecture # 8

Example Example Consider the Consider the EVEN-EVENEVEN-EVEN language, defined language, defined

over over ΣΣ={a, b}. ={a, b}.

As discussed earlier that As discussed earlier that EVEN-EVENEVEN-EVEN language can be expressed by a regular language can be expressed by a regular expression expression

(( aaaa + + bbbb + (ab+ba)(aa+bb)*(ab+ba) + (ab+ba)(aa+bb)*(ab+ba) )*)*

The language The language EVEN-EVENEVEN-EVEN may be accepted may be accepted by the following TG by the following TG

Page 11: Lecture # 8

Example continued … Example continued …

Page 12: Lecture # 8

Example Example Consider the language L, defined over Consider the language L, defined over

ΣΣ={a, b}, in which ={a, b}, in which a’s occur only in a’s occur only in even clumps (bundles) and that ends even clumps (bundles) and that ends in three or more b’sin three or more b’s. .

The language L can be expressed by its The language L can be expressed by its regular expression regular expression

(aa)*b (aa)*b (b*+((b*+(aa(aa)*baa(aa)*b)*))*) bb bb OROR

(aa)*b (aa)*b (b*+( (b*+( (aa)(aa)++bb)*))*) bb bb The language L may be accepted by the The language L may be accepted by the

following TGfollowing TG

Page 13: Lecture # 8

Example Continued … Example Continued …

Page 14: Lecture # 8

Example Example Consider the following TG Consider the following TG

Page 15: Lecture # 8

Example Continued … Example Continued … Consider the string Consider the string abbbabbbabbaabbbabbbabba. It may . It may

be observed that the above string traces be observed that the above string traces the following three paths, (using the states)the following three paths, (using the states)

(a)(b) (b) (b) (ab) (bb) (a) (bb) (a) (a)(b) (b) (b) (ab) (bb) (a) (bb) (a) (-)(4)(4)(+)(+)(3)(2)(2)(1)(+)(-)(4)(4)(+)(+)(3)(2)(2)(1)(+)

(a)(b) ((b)(b)) (ab) (bb) (a) (bb) (a) (a)(b) ((b)(b)) (ab) (bb) (a) (bb) (a) (-)(4)(+)(+)(+)(3)(2)(2)(1)(+)(-)(4)(+)(+)(+)(3)(2)(2)(1)(+)

(a) ((b) (b)) (b) (ab) (bb) (a) (bb) (a) (a) ((b) (b)) (b) (ab) (bb) (a) (bb) (a) (-) (4)(4)(4)(+) (3)(2)(2)(1)(+)(-) (4)(4)(4)(+) (3)(2)(2)(1)(+)

Page 16: Lecture # 8

Example Continued … Example Continued …

Which shows that all these paths are Which shows that all these paths are successful, (successful, (i.e. i.e. the path starting from an the path starting from an initial state and ending in a final state). initial state and ending in a final state).

Hence the string Hence the string abbbabbbabbaabbbabbbabba is is acceptedaccepted by the given TG. by the given TG.

Page 17: Lecture # 8

Generalized Transition Generalized Transition Graphs Graphs

A generalized transition graph (GTG) is a A generalized transition graph (GTG) is a collection of three things: collection of three things:

1.1. Finite number of states, at least one of which is Finite number of states, at least one of which is start state and some (maybe none) final states. start state and some (maybe none) final states.

2.2. Finite set of input letters (Finite set of input letters (ΣΣ) from which input ) from which input strings are formed. strings are formed.

3.3. Directed edges connecting some pair of states Directed edges connecting some pair of states labeled with labeled with regular expressionregular expression

It may be noted that in GTG, the labels of transition It may be noted that in GTG, the labels of transition edges are corresponding regular expressions edges are corresponding regular expressions

Page 18: Lecture # 8

Example Example Consider the language L of strings, defined Consider the language L of strings, defined

over over ΣΣ={a,b}, containing ={a,b}, containing double a or double a or double bdouble b. .

The language L can be expressed by the The language L can be expressed by the following regular expression following regular expression (a+b)* (aa + bb) (a+b)*(a+b)* (aa + bb) (a+b)*

The language L may be accepted by the The language L may be accepted by the following GTG.following GTG.

Page 19: Lecture # 8

Example continued … Example continued …

OrOr

Page 20: Lecture # 8

Example Example Consider the Language L of strings, defined Consider the Language L of strings, defined

over over ΣΣ = {a, b}, = {a, b}, beginning with and beginning with and ending in same letters excluding ending in same letters excluding ΛΛ . .

The language L may be expressed by the The language L may be expressed by the following regular expression following regular expression

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

This language may be accepted by the This language may be accepted by the following GTG following GTG

Page 21: Lecture # 8

Example Example

Page 22: Lecture # 8

Example Example Consider the language L of strings of, Consider the language L of strings of,

defined over defined over ΣΣ = {a, b}, = {a, b}, beginning and beginning and ending in different lettersending in different letters..

The language L may be expressed by RE The language L may be expressed by RE a(a + b)*b + b(a + b)*aa(a + b)*b + b(a + b)*a

The language L may be accepted by the The language L may be accepted by the following GTG following GTG

Page 23: Lecture # 8

Example Continued … Example Continued …

Another option of GTG for above language LAnother option of GTG for above language L

Page 24: Lecture # 8

Example Continued … Example Continued …

Page 25: Lecture # 8

Example Example Consider the language L of strings, defined Consider the language L of strings, defined

over over ΣΣ={a, b}, ={a, b}, having triple a or triple having triple a or triple b. b.

The language L may be expressed by RE The language L may be expressed by RE (a+b)* (aaa + bbb) (a+b)*(a+b)* (aaa + bbb) (a+b)*

This language may be accepted by the This language may be accepted by the following GTGfollowing GTG

Page 26: Lecture # 8

Example Continued … Example Continued …

OR OR

Page 27: Lecture # 8

NonDeterminism NonDeterminism TGs and GTGs provide certain relaxations TGs and GTGs provide certain relaxations

i.e. i.e. there may exist more than one path for there may exist more than one path for a certain string or there may not be any a certain string or there may not be any path for a certain string, this property path for a certain string, this property creates creates nondeterminismnondeterminism and it can also and it can also help in differentiating TGs or GTGs from help in differentiating TGs or GTGs from FAs. FAs.

Hence an Hence an FAFA is also called a is also called a Deterministic Deterministic Finite Automaton (DFA).Finite Automaton (DFA).

Page 28: Lecture # 8

Kleene’sKleene’s Theorem Theorem If a language can be If a language can be expressedexpressed by by 1.1. FA or FA or 2.2. TG or TG or 3.3. RE RE then it can also be then it can also be expressedexpressed by by other twoother two

as well. as well.

It may be noted that the theorem is It may be noted that the theorem is proved, proving the following three partsproved, proving the following three parts

Page 29: Lecture # 8

Kleene’sKleene’s Theorem continued Theorem continued … …

Kleene’s Theorem Part IKleene’s Theorem Part IIf a language can be accepted by an FA If a language can be accepted by an FA then it can be accepted by a TG as well. then it can be accepted by a TG as well.

Kleene’s Theorem Part IIKleene’s Theorem Part IIIf a language can be accepted by a TG If a language can be accepted by a TG then it can be expressed by an RE as well. then it can be expressed by an RE as well.

Kleene’s Theorem Part IIIKleene’s Theorem Part IIIIf a language can be expressed by a RE If a language can be expressed by a RE then it can be accepted by an FA as wellthen it can be accepted by an FA as well

Page 30: Lecture # 8

Kleene’sKleene’s Theorem continued Theorem continued … …

Proof(Kleene’s Theorem Part I)Proof(Kleene’s Theorem Part I)

Since every Since every FAFA can be considered to be a can be considered to be a TGTG as well, as well, therefore there is nothing to therefore there is nothing to proveprove. .

Page 31: Lecture # 8

Thank You…Thank You…


Recommended