Add exact cover problem example
This commit is contained in:
parent
b55bc82b1d
commit
a9ca72891c
5
examples/exact-cover.lp
Normal file
5
examples/exact-cover.lp
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{in(1..n)}.
|
||||||
|
|
||||||
|
:- I != J, in(I), in(J), s(X, I), s(X, J).
|
||||||
|
covered(X) :- in(I), s(X, I).
|
||||||
|
:- s(X, Y), not covered(X).
|
10
examples/exact-cover.spec
Normal file
10
examples/exact-cover.spec
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
axiom: forall X (is_int(X) <-> exists N X = N).
|
||||||
|
|
||||||
|
input: n -> integer, s/2, is_int/1.
|
||||||
|
|
||||||
|
assume: n >= 0.
|
||||||
|
assume: forall X, Y (s(X, Y) -> is_int(Y)).
|
||||||
|
|
||||||
|
assert: forall X (in(X) -> X >= 1 and X <= n).
|
||||||
|
assert: forall X (exists I s(X, I) -> exists I (in(I) and s(X, I))).
|
||||||
|
assert: forall I, J (exists X (s(X, I) and s(X, J)) and in(I) and in(J) -> I = J).
|
Loading…
Reference in New Issue
Block a user