%representation of the compound benzyl alcohol, the compound catechol and the class benzenediol

phenols(ps).
catechols(cs).

%generate phenols structure
hasAtom(X,h1(X)):- phenols(X), not rp(X).
hasAtom(X,h2(X)):- phenols(X), not rp(X).
hasAtom(X,h3(X)):- phenols(X), not rp(X).
hasAtom(X,h4(X)):- phenols(X), not rp(X).
hasAtom(X,h5(X)):- phenols(X), not rp(X).
hasAtom(X,h6(X)):- phenols(X), not rp(X).
hasAtom(X,h7(X)):- phenols(X), not rp(X).
c(h1(X)):- phenols(X), not rp(X).
c(h2(X)):- phenols(X), not rp(X).
c(h3(X)):- phenols(X), not rp(X).
c(h4(X)):- phenols(X), not rp(X).
c(h5(X)):- phenols(X), not rp(X).
c(h6(X)):- phenols(X), not rp(X).
o(h7(X)):- phenols(X), not rp(X).
doubleBond(h1(X),h2(X)):- phenols(X), not rp(X).
singleBond(h2(X),h3(X)):- phenols(X), not rp(X).
doubleBond(h3(X),h4(X)):- phenols(X), not rp(X).
singleBond(h4(X),h5(X)):- phenols(X), not rp(X).
doubleBond(h5(X),h6(X)):- phenols(X), not rp(X).
singleBond(h6(X),h1(X)):- phenols(X), not rp(X).
singleBond(h1(X),h7(X)):- phenols(X), not rp(X).
gp(h1(X)):- phenols(X), not rp(X).
gp(h2(X)):- phenols(X), not rp(X).
gp(h3(X)):- phenols(X), not rp(X).
gp(h4(X)):- phenols(X), not rp(X).
gp(h5(X)):- phenols(X), not rp(X).
gp(h6(X)):- phenols(X), not rp(X).
gp(h7(X)):- phenols(X), not rp(X).

%recognise phenols structure

phenols(X):- hasAtom(X,Y1), hasAtom(X,Y2), hasAtom(X,Y3), hasAtom(X,Y4), hasAtom(X,Y5), hasAtom(X,Y6), hasAtom(X,Y7), c(Y1), c(Y2), c(Y3), c(Y4), c(Y5), c(Y6), o(Y7), doubleBond(Y1,Y2), singleBond(Y2,Y3), doubleBond(Y3,Y4), singleBond(Y4,Y5), doubleBond(Y5,Y6), singleBond(Y6,Y1), singleBond(Y1,Y7), not gp(Y1), not gp(Y2), not gp(Y3), not gp(Y4), not gp(Y5), not gp(Y6), not gp(Y7).
rp(X):- hasAtom(X,Y1), hasAtom(X,Y2), hasAtom(X,Y3), hasAtom(X,Y4), hasAtom(X,Y5), hasAtom(X,Y6), hasAtom(X,Y7), c(Y1), c(Y2), c(Y3), c(Y4), c(Y5), c(Y6), o(Y7), doubleBond(Y1,Y2), singleBond(Y2,Y3), doubleBond(Y3,Y4), singleBond(Y4,Y5), doubleBond(Y5,Y6), singleBond(Y6,Y1), singleBond(Y1,Y7), not gp(Y1), not gp(Y2), not gp(Y3), not gp(Y4), not gp(Y5), not gp(Y6), not gp(Y7).

%generate catechols structure
hasAtom(X,f1(X)):- catechols(X), not rc(X).
hasAtom(X,f2(X)):- catechols(X), not rc(X).
hasAtom(X,f3(X)):- catechols(X), not rc(X).
hasAtom(X,f4(X)):- catechols(X), not rc(X).
hasAtom(X,f5(X)):- catechols(X), not rc(X).
hasAtom(X,f6(X)):- catechols(X), not rc(X).
hasAtom(X,f7(X)):- catechols(X), not rc(X).
hasAtom(X,f8(X)):- catechols(X), not rc(X).
c(f1(X)):- catechols(X), not rc(X).
c(f2(X)):- catechols(X), not rc(X).
c(f3(X)):- catechols(X), not rc(X).
c(f4(X)):- catechols(X), not rc(X).
c(f5(X)):- catechols(X), not rc(X).
c(f6(X)):- catechols(X), not rc(X).
o(f7(X)):- catechols(X), not rc(X).
o(f8(X)):- catechols(X), not rc(X).
doubleBond(f1(X),f2(X)):- catechols(X), not rc(X).
singleBond(f2(X),f3(X)):- catechols(X), not rc(X).
doubleBond(f3(X),f4(X)):- catechols(X), not rc(X).
singleBond(f4(X),f5(X)):- catechols(X), not rc(X).
doubleBond(f5(X),f6(X)):- catechols(X), not rc(X).
singleBond(f6(X),f1(X)):- catechols(X), not rc(X).
singleBond(f1(X),f7(X)):- catechols(X), not rc(X).
singleBond(f2(X),f8(X)):- catechols(X), not rc(X).
gc(f1(X)):- catechols(X), not rc(X).
gc(f2(X)):- catechols(X), not rc(X).
gc(f3(X)):- catechols(X), not rc(X).
gc(f4(X)):- catechols(X), not rc(X).
gc(f5(X)):- catechols(X), not rc(X).
gc(f6(X)):- catechols(X), not rc(X).
gc(f7(X)):- catechols(X), not rc(X).
gc(f8(X)):- catechols(X), not rc(X).

%recognise catechols structure

catechols(X):- hasAtom(X,Y1), hasAtom(X,Y2), hasAtom(X,Y3), hasAtom(X,Y4), hasAtom(X,Y5), hasAtom(X,Y6), hasAtom(X,Y7), hasAtom(X,Y8), c(Y1), c(Y2), c(Y3), c(Y4), c(Y5), c(Y6), o(Y7), o(Y8), doubleBond(Y1,Y2), singleBond(Y2,Y3), doubleBond(Y3,Y4), singleBond(Y4,Y5), doubleBond(Y5,Y6), singleBond(Y6,Y1), singleBond(Y1,Y7), singleBond(Y2,Y8), not gc(Y1), not gc(Y2), not gc(Y3), not gc(Y4), not gc(Y5), not gc(Y6), not gc(Y7), not gc(Y8).
rc(X):- hasAtom(X,Y1), hasAtom(X,Y2), hasAtom(X,Y3), hasAtom(X,Y4), hasAtom(X,Y5), hasAtom(X,Y6), hasAtom(X,Y7), hasAtom(X,Y8), c(Y1), c(Y2), c(Y3), c(Y4), c(Y5), c(Y6), o(Y7), o(Y8), doubleBond(Y1,Y2), singleBond(Y2,Y3), doubleBond(Y3,Y4), singleBond(Y4,Y5), doubleBond(Y5,Y6), singleBond(Y6,Y1), singleBond(Y1,Y7), singleBond(Y2,Y8), not gc(Y1), not gc(Y2), not gc(Y3), not gc(Y4), not gc(Y5), not gc(Y6), not gc(Y7), not gc(Y8).

%this is the generated stable model
%by phenols(cs) below we have catechols subClassOf phenols
%by catechols(ps) missing we have that catechols is not a subclass of phenols
{phenols(ps), catechols(cs), hasAtom(ps,h1(ps)), hasAtom(ps,h2(ps)), hasAtom(ps,h3(ps)), hasAtom(ps,h4(ps)), hasAtom(ps,h5(ps)), hasAtom(ps,h6(ps)), hasAtom(ps,h7(ps)), c(h1(ps)), c(h2(ps)), c(h3(ps)), c(h4(ps)), c(h5(ps)), c(h6(ps)), o(h7(ps)), doubleBond(h1(ps),h2(ps)), singleBond(h2(ps),h3(ps)), doubleBond(h3(ps),h4(ps)), singleBond(h4(ps),h5(ps)), doubleBond(h5(ps),h6(ps)), singleBond(h6(ps),h1(ps)), singleBond(h1(ps),h7(ps)), hasAtom(cs,f1(cs)), hasAtom(cs,f2(cs)), hasAtom(cs,f3(cs)), hasAtom(cs,f4(cs)), hasAtom(cs,f5(cs)), hasAtom(cs,f6(cs)), hasAtom(cs,f7(cs)), hasAtom(cs,f8(cs)), c(f1(cs)), c(f2(cs)), c(f3(cs)), c(f4(cs)), c(f5(cs)), c(f6(cs)), o(f7(cs)), o(f8(cs)), doubleBond(f1(cs),f2(cs)), singleBond(f2(cs),f3(cs)), doubleBond(f3(cs),f4(cs)), singleBond(f4(cs),f5(cs)), doubleBond(f5(cs),f6(cs)), singleBond(f6(cs),f1(cs)), singleBond(f1(cs),f7(cs)), singleBond(f2(cs),f8(cs)), phenols(cs), rp(cs), gp(h1(ps)), gp(h2(ps)), gp(h3(ps)), gp(h4(ps)), gp(h5(ps)), gp(h6(ps)), gp(h7(ps)), gc(f1(cs)), gc(f2(cs)), gc(f3(cs)), gc(f4(cs)), gc(f5(cs)), gc(f6(cs)), gc(f7(cs)), gc(f8(cs))}


