440 likes | 649 Views
Theory of Computation. Exercise. Design an FA for the language L of strings, defined over Σ ={a, b}, of odd length. Solution: The language L may be expressed by the following RE: (a+b)((a+b)(a+b)) * or ((a+b)(a+b)) * (a+b) This language may be accepted by the following FA.
E N D
Exercise Design an FA for the language L of strings, defined over Σ={a, b}, of odd length. Solution:The language L may be expressed by the following RE: (a+b)((a+b)(a+b))* or ((a+b)(a+b))*(a+b) This language may be accepted by the following FA
Solution continued … a,b 1 – 2+ a,b
Example Consider the Language L , defined over Σ = {a, b} of all strings including Λ, The language L may be accepted by the following FA The language L may also be accepted by the following FA a,b 2+ 1 a,b
Example Continued … The language L may be expressed by the following regular expression (a + b)* a,b
Example Consider the Language L , defined over Σ = {a, b} of all non empty strings. The language L may be accepted by the following FA The above language may be expressed by the following regular expression (a + b)+ a,b – + a,b
Example Consider the following FA, defined over Σ = {a, b} The above FA does not accept any string. Even it does not accept the null string, as there is no path starting from initial state and ending in the final. a,b – + a,b
Example Consider the Language L of strings , defined over Σ = {a, b}, containing double a. The language L may be expressed by the following regular expression (a+b)* (aa) (a+b)*. This language may be accepted by the following FA
Example Continued … 2 a,b b a a 3+ 1- b
Example Consider the language L of strings, defined over Σ={0, 1}, having double 0’s or double 1’s, The language L may be expressed by the regular expression (0+1)* (00 + 11) (0+1)* This language may be accepted by the following FA
Example Continued … + - x 0 0 0,1 0 1 1 1 y
Example Consider the language L of strings, defined over Σ={a, b},having triple a’s or triple b’s. The language L may be expressed by RE (a+b)* (aaa + bbb) (a+b)* This language may be accepted by the following FA
Example Continued … a 2 4 a a b a,b a b 1–– 6+ a b b 3 b 5
Example Consider the EVEN-EVEN language, defined over Σ={a, b}. As discussed earlier that EVEN-EVEN language can be expressed by the regular expression (aa+bb+(ab+ba)(aa+bb)*(ab+ba))* EVEN-EVEN language may be accepted by the following FA
Example Continued … b 3 1 b a a a a b 4 2 b
Example Consider the language L = {w belongs to {a,b}*: length(w) >= 2 and w neither ends in aa nor bb}. The language L may be expressed by the regular expression (a+b)*(ab+ba) This language may be accepted by the following FA
Example Continued … 4+ 2 1– 5+ 3 a b a b a a b b b a
Example Consider the language L = {w belongs to {a,b}*: w does not end in aa}. The language L may be expressed by the regular expression Λ + a + b + (a+b)*(ab+ba+bb) This language may be accepted by the following FA
Example Continued … a aa a b a b a a ab Λ b a ba b a b a b b b bb
Consider the language L= {x Є{0,1}* | x ends in 1 and does not contain the substring 00} The language L may be expressed by the regular expression (1+01)*(1+01) OR (1+01)+ This language may be accepted by the following FA Example
Example Consider the language L of strings, defined over Σ={0, 1},Strings ending in 0. The language L may be expressed by the Regular Expression: (0+1)*0 This language may be accepted by the following FA
Example Consider the language L of strings, defined over Σ={0,1},Strings ending in 11. The language L may be expressed by the Regular Expression: (0+1)*11 This language may be accepted by the following FA
Example The language L, defined over Σ={0,1}, strings ending with 10 The regular expression for the above language is: (0+1)*(10) This language may be accepted by the following FA (Next slide)
Example The language given in the previous example may also be accepted by the following FA (Next slide)
A finite automata, accepting {a+b}*{baaa}. Example
Consider the language L of strings defined over Σ={a,b}, containing ab and bba The regular expression for the above language is as (a+b)*(ab+bba)(a+b)* This language may be accepted by the following FA (Next slide) Example