程序代写代做代考 11/9/2020 Grok | COMP30026 Practice Exam

11/9/2020 Grok | COMP30026 Practice Exam
Queson 6
Queson 6 Part A (2 marks)
We define the simplicity of a regular expression as the total number of occurrences of concatenaons, unions, Kleene stars, alphabet symbols, empty string symbols, and empty set symbols in the regular expression. The simplest regular expression for a regular language is the regular expression with the smallest possible simplicity expressing that language.
For example, the regular expression has two concatenaons, one union, one Kleene star, one empty string symbol, and three alphabet symbols, for a total
simplicity of 8. However, it is not the simplest possible regular expression for its language; expresses the same language, and has simplicity 6.
Part A (2 marks)
The class of regular languages is closed under intersecon, so the language
is regular. What is the simplest regular expression for ?
Note: Paral marks will be awarded for a regular expression which is correct but not the simplest.
Instrucons
Giveyouranswerasavariabler6A :: RegExp.  Format
RegExp.hs provides a regular expression type RegExp, and a parser for regular expressions,parseRE :: String -> RegExp.Usethistypetoenteryouranswer.
For example:
The regular expression may be entered as follows:
Star (Concat (Symbol ‘b’) (Symbol ‘a’)),or
parseRE “(ba)*”.
The regular expression may be entered as follows:
Concat (Symbol ‘a’) (Union EmptyStr (Concat (Symbol ‘a’) (Symbol ‘b’))),or
parseRE “a(eps | ab)”.
https://groklearning.com/learn/unimelb-comp30026-2020-s2/prac-exam/14/ 1/1
Cheng
M
)∗a∗b(L ∩ )∗b∗a(L = M
∗)aba ∪ ε(
)ba ∪ ε(a
∗)ab(
∗)aba(