Homework 9
Last updated: Fri, 13 Nov 2026 18:48:56 -0500
Out: Sat Nov 14, 12:30pm EST Due: Sat Nov 21, 12:30pm EST
Note: Assignments are not officially "released" until—
and are subject to change without notice up to— the indicated "Out" date and time. If an assignment is posted early, students may look ahead but are responsible for ensuring that they are always working with the most recent version of the homework.
This assignment begins to explore Turing Machines and the languages associated with them.
Homework Problems
Not a Context-Free Language? (22 points)
A Turing-Recognizable Language Example (22 points)
A Decidable Language (22 points)
README (2 point)
Total: 68 points
Submitting
Submit your solution to this assignment in Gradescope hw9. Please assign each page to the correct problem and make sure your solutions are legible.
A submission must also include a README containing the required information.
1 Not a Context-Free Language?
Here is a language whose strings resemble simple Python programs.
\mathit{REALPY}_{420} = \left\{\texttt{if:}\!\hookleftarrow\!\diamond^*\texttt{pr}\diamond 1\hookleftarrow\texttt{ei:}\!\hookleftarrow\!\diamond^*\texttt{pr}\diamond 2\hookleftarrow\texttt{el:}\!\hookleftarrow\!\diamond^*\texttt{pr}\diamond 3\mid\textrm{all}\diamond^*\textrm{must match}\right\}
\Sigma = \left\{\texttt{if:},\texttt{ei:},\texttt{el:},\texttt{pr},\hookleftarrow,1,2,3,\diamond\right\} (in real-world grammars, terminal (i.e., alphabet) "symbols" are often whole words)
give 3 strings, made from the alphabet symbols, that are in the language
give 3 strings, made from the alphabet symbols, that are not in the language
Prove: NOT \mathit{REALPY}_{420} IS-A Context-free Language (CFL)
For parts 1 and 2, you may post specific examples to Piazza and ask for confirmation about your understanding of the problem.
For Part 3, use the Pumping Lemma for CFLs and proof by contradiction. Make sure your proof has all the correct components and use the proper constructors. Remember that a proof by contradiction begins with assuming the opposite of the statement to prove and then proceeds like any normal proof, EXCEPT the proof must end in the statement Contradiction! that is justified with a proof of some statement X \,\mathrm{AND}\, \textbf{NOT} X This contradiction forces one to conclude that the assumption must be False and that the original statement to prove is True.
More specifically, the contradictory statements must be "s IS-Pumpable" and "NOT (s IS-Pumpable)" where IS-Pumpable is defined by \mathrm{TheCFLPumpingLemma} and s is a counterexample that you must carefully choose that is in the language and longer than some "pumping length" p, also specified by \mathrm{TheCFLPumpingLemma}.
Interesting sidenote: This problem is feels similar to the A Context-Free Language? problem from Homework 7. But there, the language was a CFL. Here, by making the language slightly more complicated, we now have a non-CFL language that cannot be recognized by PDAs or decribed by CFGs.
2 A Turing-Recognizable Language Example
The Not a Context-Free Language? Problem above asked you to prove that \mathit{REALPY}_{420} is not a CFL.
Now prove : \mathit{REALPY}_{420} IS-A Turing-recognizable Language
Any Turing Machine you create should be a high-level description that follows the required format.
In addition, the criteria to show that a Turing machine recognizes some language is to give three example strings that are both accepted by the machine and in the language, and three examples that are both not accepted by the machine and not in the language, in an Examples Table.
3 A Decidable Language
Recall the following language from the Is It A Regular Language? problem from Homework 2.
L_{grad} = \{w\mid w\textrm{ is a valid UMB CS grad course number}\}
Prove: L_{grad} IS-A Decidable Language
You may assume that strings in the language contain only characters from alphabet \{\texttt{0},\texttt{2},\texttt{4},\texttt{6}\}, and that valid UMB CS grad courses are any three digit number starting with \texttt{6} made from alphabet characters.
If your answer involves a decider, its definition must include a termination argument.
Also, for this problem, the decider must use at least one machine we have previously defined in lecture or homework. (Remember that when creating new Turing machines, all other machines or algorithms previously constructed in class or in previous homeworks are available as a "library"!)
Finally, make sure your proof includes the necessary proof constructors and Examples Table with the appropriate columns (e.g., whether strings are in the language, whether strings are accepted by the decider, existing machines used, etc.).