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.
This commit is contained in:
2018-04-20 16:12:54 +02:00
parent 7ba48044ee
commit 2245e139b2
4 changed files with 410 additions and 210 deletions

View File

@@ -1,3 +1,6 @@
#show p/2.
#external integer(n(0)).
{p(1..n, 1..n)}.
:- p(X, Y1), p(X, Y2), Y1 != Y2.
@@ -8,5 +11,3 @@ q2(Y) :- p(_, Y).
:- not q1(X), X = 1..n.
:- not q2(Y), Y = 1..n.
#show p/2.

View File

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

View File

@@ -1,7 +1,9 @@
#show in/2.
#external integer(n(0)).
#external integer(r(0)).
{in(1..n, 1..r)}.
covered(I) :- in(I, S).
:- I = 1..n, not covered(I).
:- in(I, S), in(J, S), in(I + J, S).
#show in/2.