reserve x, X, Y for set;

theorem Th20:
  for S being non empty 1-sorted for f being Function of S, S st f
  is idempotent holds X c= rng f implies f.:X = X
proof
  let S be non empty 1-sorted;
  let f be Function of S, S such that
A1: f is idempotent;
  set M = {x where x is Element of S: x = f.x};
  assume X c= rng f;
  then
A2: X c= M by A1,Th19;
A3: f.:X c= X
  proof
    let y be object;
    assume y in f.:X;
    then consider x being object such that
    x in dom f and
A4: x in X and
A5: y = f.x by FUNCT_1:def 6;
    x in M by A2,A4;
    then ex x9 being Element of S st x9 = x & x9 = f.x9;
    hence thesis by A4,A5;
  end;
  X c= f.:X
  proof
    let y be object;
    assume
A6: y in X;
    then y in M by A2;
    then ex x being Element of S st x = y & x = f.x;
    hence thesis by A6,FUNCT_2:35;
  end;
  hence thesis by A3,XBOOLE_0:def 10;
end;
