Docsity

Automata theory assignment, Assignments of Theory of Automata

Partial preview of the text

Download Automata theory assignment and more Assignments Theory of Automata in PDF only on Docsity!

Edward’s college Peshawar

Department of computer science

Assignment

Submitted To:

Professor : Ali raza

Dept of bs(cs)

Submitted by:

Mohammad ashiq

Roll no#

Dept of bs(cs)

Date of submission: 24/7/

Q. 1 Σ= {B, aB, bab, d}B, aB, bab, d} S = BaBbabBd Find the reverse of a string S Sol: s=BaBbabd Tokenizing (B),(aB),(bab),(B),(d) Rev(s)=dBbabaBB Q:2 Prove that: a) Let S = {B, aB, bab, d}ab, bb} and T={B, aB, bab, d}ab, bb, bbbb} Show that S

= T

s={B, aB, bab, d}ab, bb} t={B, aB, bab, d}ab, bb, bbbb} the Kleene closure of s is as fallow S={B, aB, bab, d}^,ab,bb,abbb,bbab,bbbb,abab…….} the Kleene closure of t is as fallow t={B, aB, bab, d}^,ab,bb,bbbb,abbb,bbbbbbb,bbbbab,abab,bbbbbbbb…….} the language is generated by s* and t* are the same so s=t as s* ⊆ t* and t* ⊆ s* b) Let S = {B, aB, bab, d}ab, bb} and T={B, aB, bab, d}ab, bb, bbb} Show that S

≠ T

But S

 T consider the following data s={B, aB, bab, d}ab, bb} t={B, aB, bab, d}ab, bb, bbbb} the Kleene closure of s is as fallow

Q4. Prove that for any set of strings of s i. (S+)=(S)* ii. (S

)

=S

iii. Is (S

)

=(S

)

iv. (S

)

=(S

)

Every factor from s+ is made up of factor from s, excluding if it’s not in the set .Every factor from(s) is made up of factor from S,including. Every factor from S* is made up of factor from S, including. Every factor from S(S) is made up of factor from S* , including. Therefor every word in (S+)* and (S) is made up of factor from S. Therefor every word in(S+)* is also a word in(s) v. (S

)

=S

Lets say I have the below language: S = {B, aB, bab, d}a, b} So if we apply Kleene plus to that language, it is something like: S+ = {B, aB, bab, d}a, b, aa, bb, ... ..} If we apply Kleene plus to above language again, It is something like: (S+)+ = {B, aB, bab, d}a, b, aa, bb, aaa, bbb ... ..}

S+ is all concatenations of words in S excluding the /\ (the empty string) In this case, (S+)+ is all concatenations of words in S+ excluding /
So that means (S+)+ includes the words in S+. vi. Is (S

)

=(S

)

S* = {B, aB, bab, d}Λ and all concatenations of words in S}(S)+ = {B, aB, bab, d}all concatenations of words in S, but not Λ}S* already contains Λ, so (S)+ contains Λ too, since it’s part of the language.No new words are added with the + operator, so (S)+ = S. S+ = {B, aB, bab, d}all concatenations of words in S, without Λ} (S+) = {B, aB, bab, d}Λ and all concatenations of words in S+}= {B, aB, bab, d}Λ and all concatenations of (all concatenations of words in S, not Λ)}= {B, aB, bab, d}Λ and all concatenations of words in S}= SThe external * operator only added Λ to the language.Therefore (S)+ = (S+)* = S*.