reserve k, l, m, n, i, j for Nat,
  K, N for non empty Subset of NAT,
  Ke, Ne, Me for Subset of NAT,
  X,Y for set;
reserve f for Function of Segm n,Segm k;
reserve x,y for set;

theorem Th58:
  for X,Y,x,y st (Y is empty implies X is empty) for F be Function
  of X,Y,G be Function of X\/{x},Y\/{y} st G|X=F & G.x=y holds ( F is onto
  implies G is onto) & ( not y in Y & F is one-to-one implies G is one-to-one)
proof
  let X,Y,x,y such that
A1: Y is empty implies X is empty;
  let F be Function of X,Y,G be Function of (X\/{x}),(Y\/{y}) such that
A2: G|X=F and
A3: G.x=y;
  thus F is onto implies G is onto
  proof
    assume
A4: F is onto;
    Y\/{y} c= rng G
    proof
      let Fx be object such that
A5:   Fx in Y\/{y};
      now
        per cases by A5,XBOOLE_0:def 3;
        suppose
          Fx in Y;
          then Fx in rng F by A4,FUNCT_2:def 3;
          then consider x9 be object such that
A6:       x9 in dom F and
A7:       F.x9=Fx by FUNCT_1:def 3;
A8:       x9 in X by A6;
A9:       dom G=X\/{x} by FUNCT_2:def 1;
A10:      X c= X\/{x} by XBOOLE_1:7;
          G.x9=F.x9 by A2,A6,FUNCT_1:47;
          hence thesis by A7,A8,A10,A9,FUNCT_1:def 3;
        end;
        suppose
A11:      Fx in {y};
A12:      dom G =X\/{x} by FUNCT_2:def 1;
A13:      {x}c=X\/{x} by XBOOLE_1:7;
A14:      x in {x} by TARSKI:def 1;
          Fx=y by A11,TARSKI:def 1;
          hence thesis by A3,A12,A14,A13,FUNCT_1:def 3;
        end;
      end;
      hence thesis;
    end;
    then Y\/{y}=rng G;
    hence thesis by FUNCT_2:def 3;
  end;
  thus not y in Y & F is one-to-one implies G is one-to-one
  proof
    assume that
A15: not y in Y and
A16: F is one-to-one;
    let x1,x2 be object such that
A17: x1 in dom G and
A18: x2 in dom G and
A19: G.x1=G.x2;
A20: for x9 be set st x9 in X holds x9 in dom F & F.x9=G.x9 & G.x9<>y
    proof
      let x9 be set such that
A21:  x9 in X;
A22:  x9 in dom F by A1,A21,FUNCT_2:def 1;
      then
A23:  F.x9 in rng F by FUNCT_1:def 3;
      F.x9=G.x9 by A2,A22,FUNCT_1:47;
      hence thesis by A15,A21,A23,FUNCT_2:def 1;
    end;
    now
      per cases by A17,A18,XBOOLE_0:def 3;
      suppose
A24:    x1 in X & x2 in X;
        then
A25:    F.x1=G.x1 by A20;
A26:    x2 in dom F by A20,A24;
A27:    F.x2=G.x2 by A20,A24;
        x1 in dom F by A20,A24;
        hence thesis by A16,A19,A26,A25,A27;
      end;
      suppose
A28:    x1 in X & x2 in {x};
        then G.x2=y by A3,TARSKI:def 1;
        hence thesis by A19,A20,A28;
      end;
      suppose
A29:    x1 in {x} & x2 in X;
        then G.x1=y by A3,TARSKI:def 1;
        hence thesis by A19,A20,A29;
      end;
      suppose
A30:    x1 in {x} & x2 in {x};
        then x=x1 by TARSKI:def 1;
        hence thesis by A30,TARSKI:def 1;
      end;
    end;
    hence thesis;
  end;
end;
