1. Homepage
  2. Programming
  3. COMP2022/2922: Models of Computation - Assignment 2: Automation

COMP2022/2922: Models of Computation - Assignment 2: Automation

Engage in a Conversation
AustraliaUniversity of SydneyCOMP2022COMP2922Models of ComputationAutomation

comp2022/2922 Assignment 2 (80 marks) s2 2022 CourseNana.COM

Problem 1. (10 marks, 5 marks each) CourseNana.COM

Let Σ = {a, b}. For each of the following languages, provide a nondeterministic finite automaton for that language. No justification is necessary. For full marks, your automaton should use at most the specified number of states. Partial marks will be awarded for larger automata. CourseNana.COM

1.     The set of strings with the property that there are two occurrences of the same letter that are exactly 3 positions apart (i.e. there are exactly 2 letters between them). For example, abaaa L, ababa / L. (8 states) CourseNana.COM

2.     The set of strings whose length is not divisible by 6 or that contain at least two bs (or both). For example, ab, ababab L, ε, aabaaa / L. (8 states) CourseNana.COM

Problem 2. (20 marks, 10 marks each)
Let
Σ = {a, b}. For each of the following languages, prove that the language is CourseNana.COM

not regular. CourseNana.COM

3.     The set {a2nbn : n 1}. CourseNana.COM

4.     The set of strings {y0,y1,y2,···} where y0 = ε, yi = yi1ai if i is an odd positive integer, and yi = yi1bi if i is an even positive integer. For example, y0 = ε,y1 = a,y2 = abb,y3 = abbaaa,y4 = abbaaabbbb, etc. CourseNana.COM

Problem 3. (20 marks, 5/5/10) CourseNana.COM

Let Σ = {a,b}. For each of the following languages, provide a deterministic Turing Machine that decides that language. No justification is necessary. For full marks, your machines should work for any input and be reasonably efficient. Guidelines on this efficiency will be posted on Ed. CourseNana.COM

1. The language {anbn+1 : n 0}. CourseNana.COM

2. The language from Problem 2, part 2. CourseNana.COM

3. The set of strings of the form uxu, where u, x Σare strings and u ̸= ε. For example, bb, abbba, abbab, baaaaaababaa, abbababbab L while ε, b, ba, aaabab, bbabaabbaa / L. CourseNana.COM

Problem 4. (30 marks) An implicit string is a way of writing a string where we allow the use of exponents. For example, (abc)3b is an implicit string that equals abcabcabcb. Implicit strings allow us to write very long strings much more concisely, such as CourseNana.COM

(abc)10000000000000000000000000000000000db
which is too large to store in a modern computer’s memory but can be written in under 100 characters as an implicit string. An implicit string is given in the form CourseNana.COM

(x1) 1(x2) 2 ...(xk) k CourseNana.COM

where x1, x2, . . . , xk are (ordinary) strings and n1, n2, . . . , nk are positive integers. CourseNana.COM

Your task is to write code that takes an automaton N and a sequence of implicit strings from stdin, and outputs whether N accepts each of the strings to stdout. Some skeleton code will be provided (in Python) that demonstrates how to handle the input/output. You may assume that the input is valid. Your program will not be tested on invalid input. CourseNana.COM

You are guaranteed that all input automata will have fewer than 100 states, all input implicit strings will have k < 10, and that all resulting strings will be of length less than 2 CourseNana.COM

In each subproblem, 50% of the marks will be for DFA cases and 50% will be for NFA cases. CourseNana.COM

Here is an explanation of the restrictions: CourseNana.COM

  • ”small string” means that the resulting string will be of length at most 1000
  • 1 symbol” means that the implicit string will be the exponent of a single symbol
  • 1 string” means that the implicit string will be the exponent of a single string
  • ”powers of 2” means that all exponents will be powers of 2. The given ex- ample values are 250 = 1125899906842624 and 253 = 9007199254740992. You may find the Python function math.log(x,2) useful in determining which power of 2 a number is.

Hints: CourseNana.COM

  • For the small string test cases, it will be sufficient to expand out the implicit string and run the automata on it.
  • For the NFA cases, it is not recommended to convert the NFA to a DFA, because this can cause an exponential blowup in automata size. You should find a way to decide membership for NFAs while avoiding this exponential blowup.
  • For the large string test cases, expanding out the implicit string will not be sufficient, because this causes an exponential blowup in string length. You will need to find a more efficient way to run the automaton on the im- plicit string. Think about what happens when the automaton reads a single character, what happens when it reads multiple characters in sequence, and what happens when it reads the same sequence twice. Furthermore, think about working with the entire transition function, rather than just the tran- sition that actually gets taken.
  • Although the general problem (i.e., subproblem 5) is quite difficult, the first few subproblems are easier, so you should attempt them to earn partial marks even if you cannot solve the general problem. The subproblems are in rough difficulty order, so it is recommended that you gradually extend your solution to handle subsequent subproblems and/or to handle NFAs for a subproblem.
  • The restriction to powers of 2 provides a hint on how to handle the general problem. Remember that if n = 2i, then for a string x we have that xn =

(x2)2...2 with i squarings. CourseNana.COM

Get in Touch with Our Experts

WeChat (微信) WeChat (微信)
Whatsapp WhatsApp
Australia代写,University of Sydney代写,COMP2022代写,COMP2922代写,Models of Computation代写,Automation代写,Australia代编,University of Sydney代编,COMP2022代编,COMP2922代编,Models of Computation代编,Automation代编,Australia代考,University of Sydney代考,COMP2022代考,COMP2922代考,Models of Computation代考,Automation代考,Australiahelp,University of Sydneyhelp,COMP2022help,COMP2922help,Models of Computationhelp,Automationhelp,Australia作业代写,University of Sydney作业代写,COMP2022作业代写,COMP2922作业代写,Models of Computation作业代写,Automation作业代写,Australia编程代写,University of Sydney编程代写,COMP2022编程代写,COMP2922编程代写,Models of Computation编程代写,Automation编程代写,Australiaprogramming help,University of Sydneyprogramming help,COMP2022programming help,COMP2922programming help,Models of Computationprogramming help,Automationprogramming help,Australiaassignment help,University of Sydneyassignment help,COMP2022assignment help,COMP2922assignment help,Models of Computationassignment help,Automationassignment help,Australiasolution,University of Sydneysolution,COMP2022solution,COMP2922solution,Models of Computationsolution,Automationsolution,