reserve x, y for set;

theorem Th7:
  for s being finite set holds derangements s = {h where h is Function of
    s, s: h is one-to-one & for x st x in s holds h.x<>x}
  proof
    let s be finite set;
    set xx = {h where h is Function of s, s: h is one-to-one &
      for x st x in s holds h.x<>x};
    hereby let x be object;
      assume x in derangements s;
      then consider f be Permutation of s such that
A1:   x = f & f is without_fixpoints;
      for y being set holds y in s implies f.y <> y by A1,ABIAN:def 4,def 5;
      hence x in xx by A1;
    end;
    let x be object;
    assume x in xx;
    then consider h be Function of s, s such that
A2: x = h & h is one-to-one & for x st x in s holds h.x<>x;
    card s = card s; then
A3: h is onto by A2,FINSEQ_4:63;
    now
      let y be object;
      assume y is_a_fixpoint_of h;
      then y in dom h & h.y = y by ABIAN:def 3;
      hence contradiction by A2;
    end;
    then h is without_fixpoints by ABIAN:def 5;
    hence x in derangements s by A3,A2;
  end;
