Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
435 B
1
Indexable
Never
#const k = 2.
node(1..5).
edge(1,2). edge(1,3). edge(2,4).
edge(2,5). edge(3, 4). edge(4,5). 
edge(X, Y) :- edge(Y, X).

k {choose(N) : node(N)} k.
reachable(N, N):- node(N), choose(N).
reachable(N, M2) :- reachable(N, M1), edge(M1, M2), choose(N), choose(M1), choose(M2).
:- choose(N), choose(M), not reachable(N, M).
dominated(N) :- choose(N).
dominated(N) :- choose(M), edge(N, M).
:- node(N), not dominated(N).
    
#show choose/1.