|
Go backward to More Notions Go up to Top Go forward to |
|
pred divides(x, y) <=> exists(z in nat(N0, y): =(*N(x, z), y));
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));
pred isprime(x) <=>
and(not(<=N(x, N1)),
forall(y in nat(N0, x):
implies(divides(y, x), or(=(y, N1), =(y, x)))));