Go backward to Purpose of Verification Go up to Top Go forward to Specification |
gcd(x, y) := such z in N: z | x /\ z | y /\ (forall w: (w | x /\ w | y) => w <= z).
fun gcd(x, y) = let(m = if(=(x, N0), y, x): such(z in nat(N0, m): and(divides(z, x), divides(z, y), forall(w in nat(+N(z, N1), m): or(not(divides(w, x)), not(divides(w, y))))), z));
Extremely inefficient way to compute the greatest common divisor.