reserve x, X, Y for set;

theorem Th19:
  for S being non empty 1-sorted for f being Function of S, S
  holds f is idempotent implies rng f = {x where x is Element of S: x = f.x}
proof
  let S be non empty 1-sorted;
  let f be Function of S, S;
  set M = {x where x is Element of S: x = f.x};
  assume
A1: f = f*f;
A2: rng f c= M
  proof
    let y be object;
    assume
A3: y in rng f;
    then reconsider y9= y as Element of S;
    ex x being object st x in dom f & y = f.x by A3,FUNCT_1:def 3;
    then y9= f.y9 by A1,FUNCT_1:13;
    hence thesis;
  end;
  M c= rng f
  proof
    let y be object;
    assume y in M;
    then
A4: ex y9 being Element of S st y9 = y & y9 = f.y9;
    dom f = the carrier of S by FUNCT_2:def 1;
    hence thesis by A4,FUNCT_1:def 3;
  end;
  hence thesis by A2,XBOOLE_0:def 10;
end;
