reserve X,X1,X2,Y,Y1,Y2 for set, p,x,x1,x2,y,y1,y2,z,z1,z2 for object;
reserve f,g,g1,g2,h for Function,
  R,S for Relation;

theorem
  f is one-to-one iff for g,h st rng g c= dom f & rng h c= dom f & dom g
  = dom h & f*g = f*h holds g = h
proof
  thus f is one-to-one implies for g,h st rng g c=dom f & rng h c=dom f & dom
  g = dom h & f*g = f*h holds g = h
  proof
    assume
A1: f is one-to-one;
    let g,h such that
A2: rng g c= dom f & rng h c= dom f and
A3: dom g = dom h and
A4: f*g = f*h;
    x in dom g implies g.x = h.x
    proof
      assume
A5:   x in dom g;
      then
A6:   g.x in rng g & h.x in rng h by A3,Def3;
      (f*g).x = f.(g.x) & (f*h).x = f.(h.x) by A3,A5,Th13;
      hence thesis by A1,A2,A4,A6;
    end;
    hence thesis by A3,Th2;
  end;
  assume
A7: for g,h st rng g c=dom f & rng h c=dom f & dom g = dom h & f*g = f*
  h holds g = h;
  x1 in dom f & x2 in dom f & f.x1 = f.x2 implies x1 = x2
  proof
    assume that
A8: x1 in dom f and
A9: x2 in dom f and
A10: f.x1 = f.x2;
    deffunc F(object) = x1;
    consider g being Function such that
A11: dom g = {{}} and
A12: for x st x in {{}} holds g.x = F(x) from Lambda;
A13: {} in {{}} by TARSKI:def 1;
    then
A14: g.{} = x1 by A12;
    then rng g = {x1} by A11,Th4;
    then
A15: rng g c= dom f by A8,ZFMISC_1:31;
    then
A16: dom(f*g) = dom g by RELAT_1:27;
    deffunc F(object) = x2;
    consider h being Function such that
A17: dom h = {{}} and
A18: for x st x in {{}} holds h.x = F(x) from Lambda;
A19: h.{} = x2 by A18,A13;
    then rng h = {x2} by A17,Th4;
    then
A20: rng h c= dom f by A9,ZFMISC_1:31;
    then
A21: dom(f*h) = dom h by RELAT_1:27;
    x in dom(f*g) implies (f*g).x = (f*h).x
    proof
      assume
A22:  x in dom(f*g);
      then
A23:  g.x = x1 by A11,A12,A16;
      (f*g).x = f.(g.x) & (f*h).x = f.(h.x) by A11,A17,A16,A21,A22,Th12;
      hence thesis by A10,A11,A18,A16,A22,A23;
    end;
    hence thesis by A7,A11,A17,A14,A19,A15,A20,A16,A21,Th2;
  end;
  hence thesis;
end;
