Drawing Finite Automation
Drawing Finite Automation
Theory Of Automata
Created By Muhammad Nasir (SP20M2BB030) BS-COMPUTER SCIENCE EVE-A
Q.1 Build an FA for the language L of strings, defined over Σ={a, b}, of odd
length.
Possible Regular Expression
(a+b)((a+b)(a+b))*i
((a+b)(a+b))*(a+b)ii
Theory Of Automata
Created By Muhammad Nasir (SP20M2BB030) BS-COMPUTER SCIENCE EVE-A
Q.3 Consider the Language L of Strings , defined over Σ = {a, b}, beginning
with and ending in different letters.
Possible Regular Expression
a (a + b)* b + b (a + b)* aiv
Theory Of Automata
Created By Muhammad Nasir (SP20M2BB030) BS-COMPUTER SCIENCE EVE-A
Q.5 Consider the Language L , defined over Σ = {a, b} of all
nonempty strings.
Possible Regular Expression
(a+b)+vi
These FA’s will not accept any String not Here I create FA’s which can accept null with
even null, so that’s why all three FA’s are all possible strings of alphabets (a,b), I draw 2
equal FA’s both accept same so both are equivalent
Theory Of Automata
Created By Muhammad Nasir (SP20M2BB030) BS-COMPUTER SCIENCE EVE-A
Q.7 Consider the Language L of strings , defined over Σ = {a, b}, containing
double a.
Possible Regular Expression
(a+b)* (aa) (a+b)*.viii
Theory Of Automata
Created By Muhammad Nasir (SP20M2BB030) BS-COMPUTER SCIENCE EVE-A
Given Finite Automata My Creation
Q.9 Consider the language L of strings, defined over Σ= {a, b}, having triple
a’s or triple b’s.
Possible Regular Expression
(a+b)* (aaa + bbb) (a+b)*x
Theory Of Automata
Created By Muhammad Nasir (SP20M2BB030) BS-COMPUTER SCIENCE EVE-A
Possible Regular Expression
(aa+bb+(ab+ba)(aa+bb)*(ab+ba))*xi
NOT GIVEN
Theory Of Automata
Created By Muhammad Nasir (SP20M2BB030) BS-COMPUTER SCIENCE EVE-A
i
Basically as we are asked that string of the given language must have odd length, so Expression No 1 is the expression for
that language because, (a+b) is compulsory and after that ((a+b)(a+b))* have clean closure means it may or may not exist,
but if it exist we have two OR with and operator means one alphabet from (a+b) and also one another will come from next
(a+b) so string can be something like
Aaa, aab,baa,abbab, baabb, and so on.
ii
Now lets evaluate Expression 2. it is ((a+b)(a+b)*(a+b) so basically we just swap the order of given regular expression, but
it also convey the same meaning, let create some string using Regex 2 so we might get,
Aab, aba,aabba,abbaa and so on so all the string generated from these 2 expression can only have odd number of length.
iii
Now the rule for language is that, only string that start and end with same letter are accepted, so our Regular Expression
a(a + b)*a + b(a + b)*b ,
iv
This language rule is that only string starting and ending with different letters are accepted, so out regular expression a (a
+ b)* b + b (a + b)* a, there are two parts connected with OR operator means that one of them can occur at once, first part
a(a+b)*b states that letter can start with a but must end with b, and part b b(a+b)*a states that letter can begin with b but
must end with a, let see finite automata of this class
v
This language rule states that null or all string of (a,b) can be accepted, so the regex (a,b)* steric clean closure states that
all the string in result of concatenation of a and b are accepted of any length including null ^.
vi
This language rule states that all the string of a and b are accepted but not the ^ null, empty string. So instead of clean
closure we use positive closure which (a+b)+ it states that all possible string but not including null.
vii
Equivalent FA’s means if two or more FA’s accept the same language (same string) then these kind of FA’s are said to be
equivalent. Let see example to understand
viii
According to language rule it accept only the string which must contain double aa, so regex will be (a+b) * (aa) (a+b)*, first
part can be null but middle part aa must come so that it will be acceptable and the last part is again optional (clean
closure)
ix
According to language rule the langue only accept the strings(numbers) which contains 00 or 11, so for this language the
regex will be (0+1)* (00 + 11) (0+1)*,
In this regex first part is optional(clean closure) second part is necessary either 00 or 11 must have to come, then the last
part is optional(clean closure), so this regex satisfied the language rule
x
According to language rule, only the string having triple a or tiple b are accepted so the regex for this language will be
(a+b)* (aaa + bbb) (a+b)*
First part is optional (clean closure) from second part aaa or bbb must have to come and the last part is optional, so this
regex satisfied the language rule.
xi
According to language rule language is even-even which means only string having even number of a’s and even
number of b’s are acceptable, so the regex (aa+bb+(ab+ba)(aa+bb) *(ab+ba))*
First of all there is whole clean closure of regex, which means ^ and ^ is known as even, in first there are two part in first
part there must come ‘aa’ or ‘bb’ so let suppose we choose aa, and from second part must come one ‘ab’ or ‘ba’ so let
suppose we choose ba our string is aaba, next part is option so we don’t choose any thing in last part there must be one
choosen from ‘ab’ or ‘ba’ so we choose ab now our string will be
aabaab so in this string there are 4 times a and two times b which means both are even-even so this regex satisfied the
language rule