You are on page 1of 4

NAME: SYED UMAR IMTIAZ SHAH

SAP ID: 27703


SEMESTER: 6TH
SECTION: SE 6-1
DEPARTMENT: SOFTWARE ENGINEERING
SUBJECT: FORMAL METHODS
SUBMITTED TO: MUBARIZ REHMAN
Marks: 10
Assignment: 04
Due Date: 08 December, 2023
QUESTION 01

Write the regular expression for the language accepting all combinations of
a's, over the set ∑ = {a}

ANSWER 01

The regular expression for the language accepting all combinations of a's, over the set ∑ = {a}, is
given by `a*`. This regular expression denotes the language that includes zero or more
occurrences of the symbol 'a'[3][4].

QUESTION 02

Write the regular expression for the language accepting all combinations of
a's except the null string, over the set ∑ = {a}

ANSWER 02

The regular expression for the language accepting all combinations of a's except the null string,
over the set ∑ = {a}, is given by `a+`. This regular expression denotes the language that includes
one or more occurrences of the symbol 'a' and excludes the null string.

QUESTION 03

Design and write regular expressions for the following languages of alphabet
={0,1}

ANSWER 03

a) The set of strings w such that every odd position in w is a 1.

- Regular expression: `(1*01*)(1*01*)*`


b) The set of strings w such that no two consecutive 1's occur in w.

- Regular expression: `(1*01*)(1*0)*`

c) {11, 110}* {0}

- Regular expression: `1*(110*0)*`

d) The language of all strings containing exactly two 0's

- Regular expression: `0(1*01*)0(1*01*)*`

e) The language of all strings containing at least two 0's

- Regular expression: `0(1*01*)0(1*01*)+`

f) The language of all strings that does not end with 01

- Regular expression: `1*(0*0)(1*)*`

g) The language of all strings in which every 0 is immediately followed by11, i.e., {011, 0111,
010111, 010101, . . .}

- Regular expression: `0(1*0)*1*`

h) The language of all strings containing both 11 and 010 as substrings

- Regular expression: `(1*0)*11(1*0)*01*`

i) All strings that do not end with 00


- Regular expression: `1*(0*1)*(1*0)*`

j) All strings that contain an even number of 0’s

- Regular expression: `1*(0*1)*(1*0)*`

k) All strings which do not contain the substring 10

- Regular expression: `1*(0*1)*(1*0)*`

You might also like