Q1

  1. Words have two or more parts which share a common unknown variable which determines how long each part is.

The Pumping Lemma (Theorem)

The Pumping Lemma says if is a regular language then there is some such that every word of length can be written in the form for such that:

  • If and ,
  • then for all .
Link to original
3. Assume is a regular language. 1. There is some such that every and . 2. We need to satisfy and . 3. Decompose into : 1. () 2. () 3. 4. Hence, for all : 5. For this word to be in the language, the exponent of must be greater than the exponent of . However, we can pick a value of such as which gives us a word which is not in the language. This is a contradiction. 6. Hence, it is not a regular language.

  1. Construct a Turing Machine that can accept your chosen lang.
digraph {
	label="TM (explicit reject)"
	rankdir=LR
	init[shape=point]
	node[shape=doublecircle]; qaccept;
	node[shape=circle];
	init->q1
	
	# must start at a
	q1->q2 [label="a,_,>"]
	q1->qreject [label="b,_,-"]
	q1->qreject [label="_,_,-"]
 
	# seek through a
	q2->q2 [label="a,a,>"]
	q2->q3 [label="b,b,>"]
	q2->qaccept [label="_,_,-"]
 
	# seek through b
	q3->q3 [label="b,b,>"]
	q3->qreject [label="a,_,-"]
	q3->q4 [label="_,_,<"]
 
	# clear last cell and seek back to a
	q4->q5 [label="b,_,<"]
	q5->q5 [label="b,b,<"]
	q5->q6 [label="a,a,<"]
	q5->qreject [label="_,_,-"]
 
	# seek back to start
	q6->q6 [label="a,a,<"]
	q6->q1 [label="_,_,>"]
}
digraph {
	label="TM (implicit reject)"
	rankdir=LR
	init[shape=point]
	node[shape=doublecircle]; qaccept;
	node[shape=circle];
	init->q1
	
	# must start at a
	q1->q2 [label="a,_,>"]
 
	# seek through a
	q2->q2 [label="a,a,>"]
	q2->q3 [label="b,b,>"]
	q2->qaccept [label="_,_,-"]
 
	# seek through b
	q3->q3 [label="b,b,>"]
	q3->q4 [label="_,_,<"]
 
	# clear last cell and seek back to a
	q4->q5 [label="b,_,<"]
	q5->q5 [label="b,b,<"]
	q5->q6 [label="a,a,<"]
 
	# seek back to start
	q6->q6 [label="a,a,<"]
	q6->q1 [label="_,_,>"]
}

Source Code

Run with https://turingmachinesimulator.com/.

name: Check if word is in language L = {a^nb^m, n>m}
init: q1
accept: qAccept

q1,a
q2,_,>

q1,b
qReject,_,-

q1,b
qReject,_,-

q2,a
q2,a,>

q2,_
qAccept,_,-

q2,b
q3,b,>

q3,b
q3,b,>

q3,a
qReject,_,-

q3,_
q4,_,<

q4,b
q5,_,<

q5,b
q5,b,<

q5,_
qReject,_,-

q5,a
q6,a,<

q6,a
q6,a,<

q6,_
q1,_,>

Question 2

Given the language over :

  1. Show that is non-regular.

    The Pumping Lemma (Theorem)

    The Pumping Lemma says if is a regular language then there is some such that every word of length can be written in the form for such that:

    • If and ,
    • then for all .
    Link to original
  • Assume is regular.
  • Hence there is some such that every word of length can be written in the form .
  • Decompose into to satisfy , .
    • ()
    • ()
  • Hence, for all , so substitute :
  • For this word to be in the language, the exponents of the first, second and last occurrence of must equal each other.
  • If we pick, , this does not hold, which is a contradiction.
  1. The # character prevents this language from being regular, by splitting up the two parts of .

Question 3

  1. Design a Turing Machine with the properties:
    • at least one accepting computation on
    • at least one rejecting computation on
    • at least one non-terminating computation on
digraph {
	rankdir=LR
	init[shape=point]
	node[shape=doublecircle]; qaccept;
	node[shape=circle];
	init->q1
	
	# 
}