1. This question is about algorithmic problems, WHILE, and other notions of effective
computability.
(a) For EACH of the following problems, say whether it is a problem in our sense,
i.e. an algorithmic problem. If it is not, explain briefly why not.
i. Given an undirected graph where edges are annotated with distances (as
integer numbers), is there a path that visits all nodes of the graph that is no
longer than 234?
ii. Given the list of all integer numbers between 10 and 1,000,000, does it
contain more than 999 prime numbers?
(b) Which of the following notion(s) of computation can decide the same problems
as Turing Machines? No explanations required.
i. Java Programs
ii. Regular Expressions
iii. Cellular Automata
iv. Untyped Lambda Expressions
(c) Give an example of a WHILE-statement list S (written in core WHILE without
extensions) such that:
$$S + \{X:n, Y:m\} \rightarrow \{X:n+2m, Y:0\}$$
for all natural numbers n and m.
(d) For which $\sigma$ can you make the following statement hold?
$$X := cons \ nil \ nil; while \ X \{\} \{X:nil\} \rightarrow \sigma$$
Explain your answer.
(e) Write a legal WHILE-program that translates into the following programs-as-data
notation:
[ 0,
[
[ while, [hd, [var, 0]]
]
3]
]
[[:=, 1, [hd, [tl [var, 0]]]]
[if, [var, 1]
3
[[:=, 2, [cons, [quote, nil], [var, 1]]]
[:=, 3, [tl, ( tl, [var, 2]]]]
]
[]
]
]