Question: Here is a question about language of regular expressions. Please provide your answer with full explanations and I really appreciate your help! I will definitely

Here is a question about language of regular expressions. Please provide your answer with full explanations and I really appreciate your help! I will definitely give you a POSITIVE rating if your answer works! Thanks!!

An engineer is trying to merge two (poorly designed) authentication systems. The first requires users to sign in with a pin code, which is any sequence of zero or more digits. The second requires users to sign in with a pass phrase, which is any sequence of zero or more words, with each word followed by the space character (). A word is a sequence of 3-5 lower-case letters.

A token is either a pin code or a pass phrase. We are interested in determining whether the set of tokens is regular.

Here are some example tokens: helloworld; 2800; ; 9999999999; xxxxxxxxx

(a) Identify and explain the flaw in the following argument that the set of tokens is NOT regular. Give a concrete example demonstrating the flaw.

We show that the set L of tokens is not regular using the pumping lemma. Suppose, for the sake of contradiction, that L is regular. Then there exists a number n as in the pumping lemma. Let x be n repetitions of the string hello, Clearly x is a sequence of words followed by spaces, so xL; moreover |x|=6n so |x|>=n. Thus we can split x into u, and w as in the pumping lemma. If =, then uw contains two characters in a row, and is thus not a valid token. If, on the other hand, v does not contain then uw contains a word with at least 6 characters, and is thus not valid token. In either case, the pumping lemma tells us that uwL, but uw is not a token; this is a contradiction. Thus L is not regular.

(b) Identify and explain the flaw in the following argument that the set of tokens IS regular. Give a concrete example demonstrating the flaw.

Let D=0+1++9 and let A=a+b++z. Then L is matched by the regular expression (D+AAA(+A+AA))*, and is thus regular. Indeed, if xL, then x is either a pin code or a pass phrase. If it is a pin code, then x=d1d2dn where each di is a digit; each digit matches (D+AAA(+A+AA)) so x matches (D+AAA(+A+AA))*. On the other hand, if x is a pass phrase, it is a sequence of words followed by spaces; each word has 3-5 characters and then a space, so it matches AAA(+A+AA); therefore x matches (D+AAA(+A+AA))*.

(c) Is the set of tokens regular? Give a 1-2 sentence argument.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!