Add example program generating permutations

This commit is contained in:
Patrick Lühne 2018-04-11 21:35:29 +02:00
parent cc3c9b642c
commit b63ef21849
Signed by: patrick
GPG Key ID: 05F3611E97A70ABF
1 changed files with 12 additions and 0 deletions

12
examples/permutations.lp Normal file
View File

@ -0,0 +1,12 @@
{p(1..n, 1..n)}.
:- p(X, Y1), p(X, Y2), Y1 != Y2.
:- p(X1, Y), p(X2, Y), X1 != X2.
q1(X) :- p(X, _).
q2(Y) :- p(_, Y).
:- not q1(X), X = 1..n.
:- not q2(Y), Y = 1..n.
#show p/2.