 reserve x,y,z,t for object,X,Y,Z,W for set;
 reserve R,S,T for Relation;

theorem
  (id(X) * (R \ id X) = {} implies dom (R \ id X) = dom R \ X) &
  ((R \ id X) * id X = {} implies rng (R \ id X) = rng R \ X)
proof
  thus id(X) * (R \ id X) = {} implies dom (R \ id X) = dom R \ X
  proof
    assume
A1: id(X) * (R \ id X) = {};
A2: dom (R \ id X) c= dom R \ X
    proof
      let x be object;
A3:   x in dom R & not x in X implies thesis by XBOOLE_0:def 5;
      assume x in dom (R \ id X); then
A4:   ex y being object st [x,y] in (R \ id X) by XTUPLE_0:def 12;
      not x in X
      proof
        assume x in X;
        then [x,x] in id X by RELAT_1:def 10;
        hence thesis by A1,A4,RELAT_1:def 8;
      end;
      hence thesis by A4,A3,XTUPLE_0:def 12;
    end;
    dom R \ dom id X c= dom (R \ id X) by XTUPLE_0:25;
    then dom R \ X c= dom (R \ id X);
    hence thesis by A2;
  end;
  thus (R \ id X) * id(X) = {} implies rng (R \ id X) = rng R \ X
  proof
    assume
A5: (R \ id X) * id X = {};
A6: rng (R \ id X) c= rng R \ X
    proof
      let y be object;
A7:   y in rng R & not y in X implies thesis by XBOOLE_0:def 5;
      assume y in rng(R \ id X); then
A8:  ex x being object st [x,y] in R \ id X by XTUPLE_0:def 13;
      not y in X
      proof
        assume y in X;
        then [y,y] in id X by RELAT_1:def 10;
        hence thesis by A5,A8,RELAT_1:def 8;
      end;
      hence thesis by A8,A7,XTUPLE_0:def 13;
    end;
    rng R \ rng id X c= rng (R \ id X) by RELAT_1:14;
    then rng R \ X c= rng (R \ id X);
    hence thesis by A6;
  end;
end;
