anthem/examples/prime.lp
Patrick Lühne 2245e139b2
Reimplement integer variable detection
This is a reimplementation of the integer variable detection procedure.
The idea is to iteratively assume variables to be noninteger, and to
prove that this would lead to a false or erroneous result. If the proof
is successful, the variable is integer as a consequence.
2018-04-20 16:37:48 +02:00

6 lines
121 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).