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 Th109:
  X1 <> {} & Y1 <> {} & [:X1,Y1:] = [:X2,Y2:] implies X1 = X2 & Y1 = Y2
proof
  assume
A1: X1<>{};
  then consider x such that
A2: x in X1 by XBOOLE_0:7;
  assume
A3: Y1<>{};
  then consider y such that
A4: y in Y1 by XBOOLE_0:7;
  assume
A5: [:X1,Y1:] = [:X2,Y2:];
  then
A6: [:X2,Y2:] <> {} by A1,A3,Th89;
  then
A7: Y2 <> {} by Th89;
  for z holds z in X1 iff z in X2
  proof let z;
    consider y2 such that
A8: y2 in Y2 by A7,XBOOLE_0:7;
    thus z in X1 implies z in X2
    proof
      assume z in X1;
      then [z,y] in [:X2,Y2:] by A4,A5,Lm16;
      hence thesis by Lm16;
    end;
    assume z in X2;
    then [z,y2] in [:X2,Y2:] by A8,Lm16;
    hence thesis by A5,Lm16;
  end;
  hence X1 = X2 by TARSKI:2;
A9: X2 <> {} by A6,Th89;
  for z holds z in Y1 iff z in Y2
  proof let z;
    consider x2 such that
A10: x2 in X2 by A9,XBOOLE_0:7;
    thus z in Y1 implies z in Y2
    proof
      assume z in Y1;
      then [x,z] in [:X2,Y2:] by A2,A5,Lm16;
      hence thesis by Lm16;
    end;
    assume z in Y2;
    then [x2,z] in [:X2,Y2:] by A10,Lm16;
    hence thesis by A5,Lm16;
  end;
  hence thesis by TARSKI:2;
end;
