
theorem
  for X,Y being non empty set
  for f being Function of X,Y
  st f is onto
  ex g being Function of Y,X
  st f * g = id Y
proof
  let X,Y be non empty set;
  let f be Function of X,Y;
  assume A1: f is onto;
  defpred P[object, object] means $1 = f.$2;
  A2: for y being object st y in Y
  ex x being object st x in X & P[y, x]
  proof
    let y be object;
    assume y in Y;
    then reconsider yy=y as Element of Y;
    consider x being Element of X such that
    B1: f.x = yy by A1, GROUP_6:58;
    take x;
    thus x in X;
    thus P[y, x] by B1;
  end;

  consider g being Function of Y,X such that
  A3: for y being object st y in Y holds P[y, g.y]
  from FUNCT_2:sch 1(A2);
  take g;
  for y being Element of Y holds (f * g).y = y
  proof
    let y be Element of Y;
    B1: dom g = Y & dom (f * g) = dom g by FUNCT_2:123, FUNCT_2:def 1;
    y = f.(g.y) by A3
     .= (f * g).y by B1, FUNCT_1:12;
    hence (f * g).y = y;
  end;
  hence f * g = id Y by FUNCT_2:124;
end;
