The following provides a pre and post condition for the gcd method.
pre: x > 0 & y > 0
post: result > 0 &
x mod result = 0 & y mod result = 0 &
∀t:Integer · t > 0 & x mod t = 0 & y mod t = 0 ⇒ result mod t = 0
However, I’m having trouble following the post condition… to me it basically says find any integer that is divisible by both. How does it get the maximum divisor, what are the conditions actually saying?
This one assures that
resultis the greatest of all common divisors.It says that any
t, which is a common divisor ofxandy, is also a divisor ofresultEDIT: you should read the above line like this: