Question 1
(1)
- Assume , values after execution: is not mutated Hence, .
- Assume . is divergent The program will infinitely decrement
(2)
counter := !x - 1
while ¬(counter = 0) do (
y := !y + 1
counter := !counter - 1
)Since the original program does not mutate during execution, we must take care to copy it to a new memory location before continuing. Then we replicate the same loop which executes times, adding to each time.
Question 2
(1)
(1)
Note: indicates the end of the list, however is a variant of .
Let’s assume we start with the configuration as follows: Apply the first rule: As , we apply the first rule of the second set of rules: This matches the first rule of the third set of rules: This is identical to the machine code generated for which would be just as above.