anthem-rs/examples/example-prime.spec
2020-05-28 07:06:19 +02:00

14 lines
384 B
Python

input: n -> integer.
output: prime/1.
# TODO: not necessary if using the lemma below in both directions
assume: n >= 1.
spec: forall X (prime(X) -> exists N (X = N)).
spec: forall N (prime(N) <-> N > 1 and N <= n and not exists I, J (I > 1 and J > 1 and I * J = N)).
lemma(backward): forall N (composite(N) <-> N > 1 and N <= n and exists I, J (I > 1 and J > 1 and I * J = N)).