Professional Documents
Culture Documents
Übung - 8 - Musterlösung
Übung - 8 - Musterlösung
Übung - 8 - Musterlösung
Computability
A loop-program consists of a finite number of loops. Each loop has a finite number of
executions. I.e. the execution terminates after a finite time.
As Turing Machines can compute partial functions, not all functions that can be
computed by Turing Machines can be computed by loop-programs
4. Simulate if (v==0) {P1;} else {P2;} using a loop program with a variable v
y := x;
While (y != 0) { y := y - 1; P; } condition: y is a new variable not used in P
8. Transform the following Goto-program in a corresponding While-program using only
one While-loop. The value of variable x0 is the final result.