%% Vertex-cover problem %% The graph is given as facts "vtx(X)." and "edge(X,Y)" %% and k is the upper bound for vertices in a cover. %% The main predicate is "incover". Atom "incover}(X)" %% represents the fact that vertex X is in a vertex cover. % Select at least one of the ends of an edge to be included in the cover 1 { incover(X), incover(Y) } :- edge(X,Y). % Eliminate models where k+1 or more vertices have been chosen :- k+1 {incover(X):vtx(X) }.