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 Th31:
  f is one-to-one implies for g being Function holds g=f" iff dom
  g = rng f & for y,x holds y in rng f & x = g.y iff x in dom f & y = f.x
proof
  assume
A1: f is one-to-one;
  let g be Function;
  thus g = f" implies dom g = rng f & for y,x holds y in rng f & x = g.y iff x
  in dom f & y = f.x
  proof
    assume g = f";
    then
A2: g = f~ by A1,Def5;
    hence dom g = rng f by RELAT_1:20;
    let y,x;
    thus y in rng f & x = g.y implies x in dom f & y = f.x
    proof
      assume that
A3:   y in rng f and
A4:   x = g.y;
    reconsider y as set by TARSKI:1;
      y in dom g by A2,A3,RELAT_1:20;
      then [y,x] in g by A4,Def2;
      then
A5:   [x,y] in f by A2,RELAT_1:def 7;
      hence x in dom f by XTUPLE_0:def 12;
      hence thesis by A5,Def2;
    end;
    assume x in dom f & y = f.x;
    then
A6: [x,y] in f by Def2;
    hence y in rng f by XTUPLE_0:def 13;
    then
A7: y in dom g by A2,RELAT_1:20;
    reconsider x as set by TARSKI:1;
    [y,x] in g by A2,A6,RELAT_1:def 7;
    hence thesis by A7,Def2;
  end;
  assume that
A8: dom g = rng f and
A9: for y,x holds y in rng f & x = g.y iff x in dom f & y = f.x;
  let a,b be object;
  thus [a,b] in g implies [a,b] in f"
  proof
    assume
A10: [a,b] in g;
    reconsider b as set by TARSKI:1;
A11: a in dom g by XTUPLE_0:def 12,A10;
    then b = g.a by A10,Def2;
    then b in dom f & a = f.b by A8,A9,A11;
    then [b,a] in f by Def2;
    then [a,b] in f~ by RELAT_1:def 7;
    hence thesis by A1,Def5;
  end;
  assume [a,b] in f";
  then [a,b] in f~ by A1,Def5;
  then
A12: [b,a] in f by RELAT_1:def 7;
  then
A13: b in dom f by XTUPLE_0:def 12;
    reconsider a as set by TARSKI:1;
  a = f.b by A12,Def2,A13;
  then a in rng f & b = g.a by A9,A13;
  hence thesis by A8,Def2;
end;
