reserve u,v,x,x1,x2,y,y1,y2,z,p,a for object,
        A,B,X,X1,X2,X3,X4,Y,Y1,Y2,Z,N,M for set;

theorem
  Z <> {} & ([:X,Z:] c= [:Y,Z:] or [:Z,X:] c= [:Z,Y:]) implies X c= Y
proof
  assume Z<>{};
  then consider z such that
A1: z in Z by XBOOLE_0:7;
  assume
A2: [:X,Z:] c= [:Y,Z:] or [:Z,X:] c= [:Z,Y:];
  let x;
  assume x in X;
  then [x,z] in [:X,Z:] & [z,x] in [:Z,X:] by A1,Def2;
  then [x,z] in [:Y,Z:] or [z,x] in [:Z,Y:] by A2;
  hence thesis by Lm16;
end;
