 reserve X,Y for set,
         n,m,k,i for Nat,
         r for Real,
         R for Element of F_Real,
         K for Field,
         f,f1,f2,g1,g2 for FinSequence,
         rf,rf1,rf2 for real-valued FinSequence,
         cf,cf1,cf2 for complex-valued FinSequence,
         F for Function;

theorem
  ex X st X c= dom F & rng F = rng(F|X) & (F|X) is one-to-one
proof
  defpred P[object,object] means
   F.$2=$1;
A1: for x be object st x in rng F ex y being object st y in dom F & P[x,y]
   by FUNCT_1:def 3;
  consider g being Function of rng F,dom F such that
A2:  for x be object st x in rng F holds P[x,g.x] from FUNCT_2:sch 1(A1);
  take X=rng g;
  set FX=F|X;
  dom F={} iff rng F={} by RELAT_1:42;
  then
A3: dom g=rng F by FUNCT_2:def 1;
  thus
A4: X c=dom F by RELAT_1:def 19;
A5: rng F c=rng FX
    proof
      let y be object;
      assume y in rng F;
      then g.y in X & F.(g.y)=y by A2,A3,FUNCT_1:def 3;
      hence thesis by A4,FUNCT_1:50;
    end;
  rng FX c=rng F by RELAT_1:70;
  hence rng F=rng FX by A5;
  now let x1,x2 be object;
    assume that
A6:   x1 in dom FX and
A7:   x2 in dom FX and
A8:   FX.x1=FX.x2;
A9:   FX.x1=F.x1 & FX.x2=F.x2 by A6,A7,FUNCT_1:47;
A10:  dom FX c=X by RELAT_1:58;
    then consider y1 be object such that
A11:  y1 in dom g and
A12:  g.y1=x1 by A6,FUNCT_1:def 3;
    consider y2 be object such that
A13:  y2 in dom g & g.y2=x2 by A7,A10,FUNCT_1:def 3;
   F.x1=y1 by A2,A3,A11,A12;
    hence x1=x2 by A2,A3,A8,A9,A12,A13;
  end;
  hence thesis by FUNCT_1:def 4;
end;
