2
4
Computation 2
int main(int x,y) {
2 int r = x % y;
3 if (r== 0) goto 8;
4 x = y;
5 y = r;
6 r = x % y;
7 goto 3;
8 return y; }
Input: 53 10
•
Line 1, x=?,y=?,r=?
•
Line 2, x=53, y=10, r=?
•
Line 3, x= 53, y=10, r=3
•
Line 4, x=53, y=10, r=3
•
Line 5, x=10, y=10, r=3
•
Line 6, x=10, y=3, r=3
•
Line 7, x=10, y=3, r=1
•
Line 3, x=10, y=3, r=1
•
...
5
Computations 1 and 2
•
Line 1, x=?,y=?,r=?
•
Line 2, x=53, y=10, r=?
•
Line 3, x= 53, y=10, r=3
•
Line 4, x=53, y=10, r=3
•
Line 5, x=10, y=10, r=3
•
Line 6, x=10, y=3, r=3
•
Line 7, x=10, y=3, r=1
•
Line 3, x=10, y=3, r=1
•
...
•
Line 1, x=?,y=?,r=?
•
Line 2, x=10, y=3,r=?
•
Line 3, x=10, y=3, r=1
•
Line 4, x=10, y=3, r=1
•
Line 5, x= 3, y=3, r=1
•
Line 6, x=3, y=1, r=1
•
Line 7, x=3, y=1, r=0
•
Line 3, x=3, y=1, r=0
•
Line 8, x=3, y=1, r=0
•
Output is 1
6
Observation
int main(int x,y) {
2 int r = x % y;
3 if (r== 0) goto 8;
4 x = y;
5 y = r;
6 r = x % y;
7 goto 3;
8 return y; }
•
Line 3, x= 10, y=3, r=1
•
Program and current
configuration
–
Together, these two pieces of
information are enough to
complete the computation
–
Are they enough to determine
what the original input was?
•
No!
•
Both previous inputs, 10 3 as
well as 53 10 eventually
reached the same
configuration (Line 3, x=10,
y=3, r=1)