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
  rng f c= Y & (for g,h st dom g = Y & dom h = Y & g*f = h*f holds g = h)
  implies Y = rng f
proof
  assume that
A1: rng f c= Y and
A2: for g,h st dom g = Y & dom h = Y & g*f = h*f holds g = h;
  Y c= rng f
  proof
    deffunc F(object) = {};
    let y be object;
    assume that
A3: y in Y and
A4: not y in rng f;
    defpred P[object,object] means
    ($1 = y implies $2 = {{}}) & ($1 <> y implies $2 = {});
A5: x in Y implies ex y1 st P[x,y1]
    proof
      assume x in Y;
      x = y implies thesis;
      hence thesis;
    end;
A6: for x,y1,y2 st x in Y & P[x,y1] & P[x,y2] holds y1 = y2;
    consider h being Function such that
A7: dom h = Y and
A8: for x st x in Y holds P[x,h.x] from FuncEx(A6,A5);
A9: dom(h*f) = dom f by A1,A7,RELAT_1:27;
    consider g being Function such that
A10: dom g = Y and
A11: x in Y implies g.x = F(x) from Lambda;
A12: dom(g*f) = dom f by A1,A10,RELAT_1:27;
    x in dom f implies (g*f).x = (h*f).x
    proof
      assume
A13:  x in dom f;
      then f.x in rng f by Def3;
      then
A14:  g.(f.x) = {} & h.(f.x) = {} by A1,A4,A11,A8;
      (g*f).x = g.(f.x) by A12,A13,Th12;
      hence thesis by A9,A13,A14,Th12;
    end;
    then
A15: g = h by A2,A10,A7,A12,A9,Th2;
    g.y = {} by A3,A11;
    hence contradiction by A3,A8,A15;
  end;
  hence thesis by A1;
end;
