11/9/2020 Grok | COMP30026 Practice Exam
Ques on 9 (6 marks)
Ques on 9 (6 marks)
Construct a Turing machine (over alphabet ) which will decide the language consis ng of all strings of length 4 or greater, having as their fourth last symbol. More formally,
For example, abba and bbaaab are in , but baba and aaa are not. Instruc ons
PresenttheTuringmachineasaHaskellexpressiontm9 :: TM.Inthedefini onofyour Turing machine, indicate clearly the ini al state , the accept state , and the reject state (even if your transi ons don’t men on the la er).
Format
The Haskell representa on defined in TM.hs allows us to represent Turing machines bydescribingtheirstates,inputalphabet,tapealphabet(including’ ‘),transi on
func on, start state, accept state, and reject state. States must be non-nega ve integers.
In the transi on func on, you can leave out transi ons to the machine’s reject state, with the understanding that missing transi ons are transi ons to the reject state. That is, if the machine gets stuck before reaching an accept state, we assume it rejects.
For example, this Turing machine:
https://groklearning.com/learn/unimelb-comp30026-2020-s2/prac-exam/23/ 1/1
Cheng
aq 0q
} a si w ni lobmys tsal htruof eht dna∣w{ = A ,erom ro 4 htgnel sah ∗}b,a{ ∈ w∣
a
A }b,a{ M
A
rq