anthem/examples/prime.lp
Patrick Lühne ea885f5fdb
Fix integer detection
Clingo treats operations that were assumed to be “invalid” not as
processing errors but as operations returning an empty set.

This changes how formulas have to be evaluated. This commit implements
an explicit function for retrieving the return type of an expression,
that is, both the domain of the result as well as whether it’s an empty,
unit, or general set with multiple values.
2018-04-22 17:04:15 +02:00

6 lines
122 B
Plaintext

#show prime/1.
%#external integer(n(0)).
composite(I * J) :- I = 2..n, J = 2..n.
prime(N) :- N = 2..n, not composite(N).