%
% CS 430 Dependency Example (Dr. Mike Lam)
%

installed(libstring).
installed(libssl).
installed(libreadline).

requires(libreadline, libstring).
requires(liburl, libstring).
requires(libhttp, liburl).
requires(ruby, libssl).
requires(ruby, libreadline).
requires(ruby, libyaml).
requires(python, libreadline).
requires(python, libssl).
requires(apache, libssl).
requires(apache, libhttp).

depends(X,Y) :- requires(X,Y).
depends(X,Y) :- requires(X,Z), depends(Z,Y).

install(X,Y) :- depends(X,Y), \+installed(Y).
install(X,X) :- \+installed(X).

