
   %  Atoms that start with u-z are treated as variables.
   %  Atoms that start with f,g are treated as Skolem constants/functions.
   %  To be safe, DO NOT USE ATOMS THAT START WITH THESE CHARACTERS FOR
   %  OTHER PURPOSES.  

   %  The constraints 41, 61, and 71 use a heuristic of having
   %  different relation names to prevent some resolutions.

constraint(1,all(x,all(y,sale(x,y) imp exists(z,supply(z,x,y))))).

constraint(2,all(x,all(y,all(z,supply(x,y,z) and class(z,type4) 
     imp (x=comp))))).

constraint(3,all(x,all(y,supply(x,y,handguns) imp 
			 exists(z,supply(x,z,bullets))))).

constraint(4,all(x,all(y,all(z,supply(x,y,z) and class(z,type1) 
    imp exists(u,exists(v,supply(x,v,u) and class(u,type2))))))).

constraint(42,all(x,all(y,all(z,supply(x,y,z) and class(z,type1) 
    imp exists(u,exists(v,supply(x,v,u) and class(u,type2) and ~type1=type2)))))).

constraint(43,~type1=type2 and all(x,all(y,all(z,supply(x,y,z) and class(z,type1) 
    imp exists(u,exists(v,supply(x,v,u) and class(u,type2))))))).

constraint(41,all(x,all(y,all(z,supply2(x,y,z,1) and class2(z,type1,1) 
    imp exists(u,exists(v,supply2(x,v,u,2) and class2(u,type2,2))))))).

constraint(5,all(x,all(y,all(z,supply(x,y,item1) and supply(x,z,item1)
     imp (y=z))))).

constraint(6,all(x,all(y,all(z,sub(x,y) and sub(y,z) imp sub(x,z))))).

constraint(61,all(x,all(y,all(z,sub2(x,y,1) and sub2(y,z,2) imp sub2(x,z,3))))).

constraint(7,exists(u,class(u,type3) and all(x,all(y,all(z,supply(x,y,z)
		imp exists(v,supply(x,v,u))))))).

constraint(71,exists(u,class(u,type3) and all(x,all(y,all(z,supply2(x,y,z,1)
		imp exists(v,supply2(x,v,u,2))))))).

constraint(9,all(x1,all(x2,all(x3,all(x4,all(x5,
    p(x1,x2,x3) and p(x1,x4,x5) imp p(x1,x2,x5))))))).

constraint(10,all(x,all(y,all(z,par(x,y) and par(y,z) imp r(x))))).

constraint(12,all(x,all(y,all(z,s(s3,x,y,z) imp 
		    exists(u,j(y,u,adelaide)) or 
		    exists(v,j(y,v,perth)))))).

constraint(13,all(y,s2(s3,y) imp 
		    j2(y,adelaide) or 
		    j2(y,perth))).

constraint(14,all(x,s2(x,nuts) imp s2(x,bolts))).


    %  In the updates, there are implied universal quantifiers
    %  around the "iff" formulas.

update(insert,p,pold, pnew(x1,x2,x3) iff pold(x1,x2,x3) 
  or ((x1=a) and (x2=b) and (x3=c))).
update(delete,p,pold, pnew(x1,x2,x3) iff pold(x1,x2,x3) 
  and (~(x1=a) or ~(x2=b) or ~(x3=c))).

update(insert,supply2,supply2old,supply2new(x,y,z,w) iff supply2old(x,y,z,w) or
    ((x=a) and (y=b) and (z=c))).
update(delete,supply2,supply2old,supply2new(x,y,z,w) iff supply2old(x,y,z,w) and
    (~(x=a) or ~(y=b) or ~(z=c))).

update(insert,supply,supplyold,supplynew(x,y,z) iff supplyold(x,y,z) or
    ((x=a) and (y=b) and (z=c))).
update(delete,supply,supplyold,supplynew(x,y,z) iff supplyold(x,y,z) and
    (~(x=a) or ~(y=b) or ~(z=c))).

update(insert,sale,saleold,salenew(x,y) iff 
			or(saleold(x,y),(x=a)and(y=b))).
update(insert2,sale,saleold,salenew(x,y) iff 
	saleold(x,y) or ((x=a) and (y=b)) or ((x=aa) and (y=bb))).
update(change,sale,saleold,salenew(x,y) iff (saleold(x,y) and ~(y=a)) or
    exists(z,saleold(z,a) and (x=b) and (y=c))).

update(insert,class2,class2old,class2new(x,y,w) iff class2old(x,y,w) or
    ((x=a) and (y=b))).
update(delete,class2,class2old,class2new(x,y,w) iff class2old(x,y,w) and
       (~(x=a) or ~(y=b))).

update(insert,class,classold,classnew(x,y) iff classold(x,y) or
    ((x=a) and (y=b))).
update(delete,class,classold,classnew(x,y) iff classold(x,y) and
       (~(x=a) or ~(y=b))).

update(insert,sub,subold,subnew(x,y) iff subold(x,y) or
       ((x=a) and (y=b))).
update(delete,sub,subold,subnew(x,y) iff subold(x,y) and
       (~(x=a) or ~(y=b))).

update(insert,sub2,sub2old,sub2new(x,y,w) iff sub2old(x,y,w) or
       ((x=a) and (y=b))).
update(delete,sub2,sub2old,sub2new(x,y,w) iff sub2old(x,y,w) and
       (~(x=a) or ~(y=b))).

update(insert,par,parold,parnew(x,y) iff parold(x,y) or
       ((x=a) and (y=b))).
update(delete,par,parold,parnew(x,y) iff parold(x,y) and
       (~(x=a) or ~(y=b))).

update(insert,s,sold,snew(x,y,z,w) iff sold(x,y,z,w) or
       ((x=a) and (y=b) and (z=c) and (w=d))).
update(delete,j,jold,jnew(x,y,z) iff jold(x,y,z) and
       (~(x=a) or ~(y=b) or ~(z=c))).

update(insert,s2,s2old,s2new(x,y) iff s2old(x,y) or
       ((x=a) and (y=b))).
update(delete,j2,j2old,j2new(x,y) iff j2old(x,y) and
       (~(x=a) or ~(y=b))).
