1. Homepage
  2. Coding
  3. COMP30026 Models of Computation - Assignment 2: Regular Languages, DFA Construction, Context-Free Languages, Closure Properties and Pumping Lemma

COMP30026 Models of Computation - Assignment 2: Regular Languages, DFA Construction, Context-Free Languages, Closure Properties and Pumping Lemma

Get in Touch with Our Experts
UnimelbCOMP30026Models of ComputationRegular LanguagesDFA ConstructionContext-Free LanguagesClosure PropertiesPumping LemmaPython

Assignment 2 Assignment Writing Service

COMP30026 Models of Computation School of Computing and Information Systems Assignment Writing Service

To improve your understanding of formal languages, automata, and grammars; to develop your skills in analysis and formal reasoning about complex concepts, and to practise writing down formal arguments with clarity.
Assignment Writing Service

Marking Assignment Writing Service

Each question is worth 2 marks, for a total of 12. We aim to ensure that anyone with a basic comprehension of the subject matter receives a passing mark. Getting full marks is intended to be considerably more difficult; the harder questions provide an opportunity for students to distinguish themselves. Assignment Writing Service

Your answers will be marked on correctness and clarity. Do not leave us guessing! We are trying to give you feedback, so you can improve. It is better to be clear and wrong; vague answers will attract few if any marks. This also means you must show your working in mechanical questions! Assignment Writing Service

Finally, make sure your writing is legible! We cannot mark what we cannot read. (Keep in mind that the exam will be on paper, so this will be even more important later!) Assignment Writing Service

Academic Integrity Assignment Writing Service

In this assignment, individual work is called for. By submitting work for assessment you declare that: Assignment Writing Service

  1. You understand the University’s policy on academic integrity. Assignment Writing Service

  2. The work submitted is your original work. Assignment Writing Service

  3. You have not been unduly assisted by any other person or third party. Assignment Writing Service

  4. You have not unduly assisted anyone else. Assignment Writing Service

  5. You have not used any unauthorized materials, including but not limited to AI and translation software Assignment Writing Service

However, if you get stuck, you can use the discussion board to ask any ques- tions you have. If your question reveals anything about your approach or work- ing, please make sure that it is set to “private”. Assignment Writing Service

You may only discuss the assignment in basic terms with your peers (e.g. clarifying what the question is asking, or recommending useful exercises). You may not directly help others in solving these problems, even by suggesting strategies. Assignment Writing Service

Soliciting or accepting further help from non-staff is cheating and will lead to disciplinary action. Assignment Writing Service

Submission – VERY IMPORTANT! Assignment Writing Service

Submission is via Gradescope. Q4–Q6 are written questions and will be sub- mitted as usual. But for Q1–Q3, you will submit your answers as Python programs. For submission, you will make use of the Python automata library, available at https://pypi.org/project/automata-lib/. To use the visual component (highly recommended), you must first install PyGraphviz by fol- lowing the instructions at https://pygraphviz.github.io/documentation/ stable/install.html. Assignment Writing Service

We highly recommend installing the visual component, so you can visualize your automata before submission. If you do so, the library supports rendering automata automatically in Jupyter notebooks, which we strongly recommend. In any case, it will be easiest for you to start on paper and then transfer your work! Assignment Writing Service

When you submit, the autograder will run some sanity checks to make sure your code is well-formed and passes very basic testing. More thorough testing will be conducted later. Assignment Writing Service

Submitted code will only be assessed for correctness. Other at- tributes, such as readability or efficiency, will not be assessed. (Nonetheless, your code should finish almost instantaneously. If it is taking a noticeable amount of time, that is a sign that something is wrong.) Assignment Writing Service

Q1 Regular Languages: Zero Blocks Assignment Writing Service

Consider the language 𝐿 of all binary strings with at least two blocks of 0’s of even length, where we define a “block of 0’s” to be a maximal nonempty substring of 0’s. (By maximal, we mean that a block of 0’s is not adjacent to any other 0’s.) For example: Assignment Writing Service

• The function q1b() takes no arguments and must return a string. The string is a regular expression following the syntax at https://caleb531. github.io/automata/api/regular-expressions/. Their syntax offers extra operators, but use only union (|), star (*), concatenation (juxtapo- sition), and grouping (( and )) in your submission. (The format will be checked will be automatically checked at submission time.) Assignment Writing Service

Task A Assignment Writing Service

Write a function q1a() which returns a DFA that recognises 𝐿. Task B Assignment Writing Service

Write a function q1b() which returns a regular expression for 𝐿. Assignment Writing Service

Q2 DFA Construction: Injection Assignment Writing Service

Given languages 𝐿𝐴 and 𝐿𝐵 over an alphabet Σ, define inject(𝐿𝐴,𝐿𝐵) to be the language Assignment Writing Service

{𝑥𝑤𝑦 ∣ 𝑥𝑦 ∈ 𝐿𝐴,𝑤 ∈ 𝐿𝐵}. Assignment Writing Service

That is, the language inject(𝐿𝐴,𝐿𝐵) is the set of all strings which can be made by inserting, at any point, a string from 𝐿𝐵 into a string from 𝐿𝐴.1 Assignment Writing Service

If 𝐿𝐴 and 𝐿𝐵 are regular, then inject(𝐿𝐴,𝐿𝐵) is also regular. The goal of this question is to design a construction method that, given DFAs 𝐴 for 𝐿𝐴 and 𝐵 for 𝐿𝐵, produces a NFA for inject(𝐿𝐴,𝐿𝐵). You may assume that 𝐴 and 𝐵 have unique accept states. Assignment Writing Service

For submission, upload a single Python source file q2.py which defines func- tions q2a() and q2b(a, b). Assignment Writing Service

• The function q2a() takes no arguments and must return a string. Assignment Writing Service

• The function q2b(a, b) takes two arguments, each a DFA, and returns an NFA. The inputs will be instances of automata.fa.dfa.DFA, the return value must be an instance of automata.fa.nfa.NFA. Assignment Writing Service

Task A Assignment Writing Service

Your friend suggests the following method: Assignment Writing Service

1. Takeacopyof𝐴andacopyof𝐵 Assignment Writing Service

2. Use the same initial state and accept state as 𝐴 Assignment Writing Service

3. For every state 𝑞𝑎 in 𝐴, add an 𝜖 transition to the start state of 𝐵 and an 𝜖 transition from the accept state of 𝐵 to 𝑞𝑎 Assignment Writing Service

The idea is that we process 𝑥 in 𝐴 and then jump to 𝐵 and after processing 𝑤 in 𝐵, we jump back to 𝐴 and process 𝑦 in 𝐴. For example, suppose 𝐿𝐴 is the set of even-length2 strings that are all 0s and 𝐿𝐵 is the set of even-length Assignment Writing Service

1More verbosely: inject(𝐿𝐴, 𝐿𝐵) = {𝑠 ∈ Σ∣ ∃𝑥, 𝑦 ∈ Σ∃𝑤 ∈ 𝐿𝐵(𝑥𝑦 ∈ 𝐿𝐴 ∧ 𝑠 = 𝑥𝑤𝑦}. 2Recall that 0 is an even number. Assignment Writing Service

stringsthatareall1s,i.e. 𝐿𝐴 ={02𝑛 ∣𝑛≥0}and𝐿𝐵 ={12𝑛 ∣𝑛≥0}. Then this is a DFA for 𝐴: Assignment Writing Service

This is a DFA for 𝐵: Assignment Writing Service

and this is the result of applying the above construction method: Assignment Writing Service

1 Assignment Writing Service

𝑞0𝑞1𝑞
0 1 20,1 Assignment Writing Service

0 Assignment Writing Service

𝜖 𝜖 Assignment Writing Service

𝑞1𝑞 𝑞
3 4050,1 Assignment Writing Service

1 Assignment Writing Service

Your task is to show that this construction method does not work for the above example. In particular, write a function q2a() which returns a string that is accepted by the NFA above but is not in inject(𝐿𝐴,𝐿𝐵). Assignment Writing Service

Task B Assignment Writing Service

Write a function q2b(a, b) which returns an NFA for inject(𝐿𝐴,𝐿𝐵), where 𝐿𝐴 is the language of the DFA a and 𝐿𝐵 is the language of the DFA b. Assignment Writing Service

Q3 Context-Free Languages: PDA and CFG Design Assignment Writing Service

Consider the language
𝐿 = {𝑥𝑦 ∣ 𝑥,𝑦 ∈ Σ,|𝑥| = |𝑦|,𝑏 occurs in y} Assignment Writing Service

where Σ = {𝑎, 𝑏}.
For submission, upload a single Python source file
q3.py which defines func- Assignment Writing Service

tions q3a() and q3b(). Assignment Writing Service

Q4 Closure Properties Assignment Writing Service

For all integers 𝑝, 𝑞 and 𝑟, the language
{𝑎𝑛𝑏𝑚 ∣𝑛,𝑚≥0,𝑛𝑝+𝑚𝑞=𝑟} Assignment Writing Service

Assignment Writing Service

is context-free. Using this fact and the closure properties of context-free lan- Assignment Writing Service

guages, prove that Assignment Writing Service

𝐿={𝑎𝑛𝑏𝑚 ∣𝑛,𝑚≥0} Assignment Writing Service

is also context-free. In your proof, do not use any languages other than these or those derived from these using closure properties. (Proofs violating this requirement will receive 0 marks.) Assignment Writing Service

Q5 Pumping Lemma for Regular Languages Assignment Writing Service

Using the pumping lemma for regular languages, prove that Assignment Writing Service

𝐿={𝑎𝑛𝑏𝑚𝑐𝑘 ∣𝑛,𝑚,𝑘≥0,𝑛𝑚=2𝑘} Assignment Writing Service

is not regular. Assignment Writing Service

Q6 Pumping Lemma for Context-Free Languages Assignment Writing Service

Let Σ = {𝑎,𝑏} and
𝐿={𝑤∈Σforallnonempty𝑠∈Σ,thestring𝑠𝑠𝑠doesnotoccurin𝑤}. Assignment Writing Service

The language 𝐿 is infinite. Using this fact and the pumping lemma for context- free languages, prove that 𝐿 is not context-free. Assignment Writing Service

联系辅导老师!
私密保护
WeChat 微信
Unimelb代写,COMP30026代写,Models of Computation代写,Regular Languages代写,DFA Construction代写,Context-Free Languages代写,Closure Properties代写,Pumping Lemma代写,Python代写,Unimelb代编,COMP30026代编,Models of Computation代编,Regular Languages代编,DFA Construction代编,Context-Free Languages代编,Closure Properties代编,Pumping Lemma代编,Python代编,Unimelb代考,COMP30026代考,Models of Computation代考,Regular Languages代考,DFA Construction代考,Context-Free Languages代考,Closure Properties代考,Pumping Lemma代考,Python代考,Unimelb代做,COMP30026代做,Models of Computation代做,Regular Languages代做,DFA Construction代做,Context-Free Languages代做,Closure Properties代做,Pumping Lemma代做,Python代做,Unimelbhelp,COMP30026help,Models of Computationhelp,Regular Languageshelp,DFA Constructionhelp,Context-Free Languageshelp,Closure Propertieshelp,Pumping Lemmahelp,Pythonhelp,Unimelb作业代写,COMP30026作业代写,Models of Computation作业代写,Regular Languages作业代写,DFA Construction作业代写,Context-Free Languages作业代写,Closure Properties作业代写,Pumping Lemma作业代写,Python作业代写,Unimelb编程代写,COMP30026编程代写,Models of Computation编程代写,Regular Languages编程代写,DFA Construction编程代写,Context-Free Languages编程代写,Closure Properties编程代写,Pumping Lemma编程代写,Python编程代写,Unimelb作业答案,COMP30026作业答案,Models of Computation作业答案,Regular Languages作业答案,DFA Construction作业答案,Context-Free Languages作业答案,Closure Properties作业答案,Pumping Lemma作业答案,Python作业答案,