previous up next
Go backward to More Notions
Go up to Top
Go forward to
RISC-Linz logo

Logic Evaluator

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))))),

pred isprime(x) <=>
  and(not(<=N(x, N1)),
    forall(y in nat(N0, x):
      implies(divides(y, x), or(=(y, N1), =(y, x)))));

Author: Wolfgang Schreiner
Last Modification: November 16, 1999

previous up next