reserve i,j,n,k,m for Nat,
     a,b,x,y,z for object,
     F,G for FinSequence-yielding FinSequence,
     f,g,p,q for FinSequence,
     X,Y for set,
     D for non empty set;

theorem Th27:
  for F be finite set
  for E be Enumeration of F st  not y in union F  holds
    Swap(E,x,y) is  Enumeration of swap(F,x,y)
proof
let F be finite set;

  let E be Enumeration of F such that A1: not y in union F;
set S=Swap(E,x,y);
A2: dom S = dom E = Seg len E by Def4,FINSEQ_1:def 3;
A3: rng E=F by RLAFFIN3:def 1;
A4: rng S c= swap(F,x,y)
  proof
    let a be object;
    assume a in rng S;
    then consider c be object such that
A5:   c in dom S & S.c = a by FUNCT_1:def 3;
A6:   E.c in rng E by A5,A2,FUNCT_1:def 3;
    per cases;
    suppose
A7:     x in E.c;
      then S.c = ((E.c)\{x})\/{y} by A5,A2,Def4;
      then S.c in {(A\{x})\/{y} where A is Element of F: x in A} by A7,A6;
      hence thesis by A5,XBOOLE_0:def 3;
    end;
    suppose
A8:     not x in E.c;
      then S.c = ((E.c)\/{x}) by A5,A2,Def4;
      then S.c in {A\/{x} where A is Element of F: not x in A & A in F}
        by A8,A6;
      hence thesis by A5,XBOOLE_0:def 3;
    end;
  end;
  swap(F,x,y) c= rng S
  proof
    let a be object;
    assume a in swap(F,x,y);
    then per cases by XBOOLE_0:def 3;
    suppose a in {(A\{x})\/{y} where A is Element of F: x in A};
      then consider A be Element of F such that
A9:     a = (A\{x})\/{y} & x in A;
      F<>{} by A9,SUBSET_1:def 1;then
      consider b be object such that
A10:    b in dom E & E.b = A by A3,FUNCT_1:def 3;
      S.b = ((E.b)\{x})\/{y} by Def4,A9,A10;
      hence thesis by A9,A10,A2,FUNCT_1:def 3;
    end;
    suppose a in {A\/{x} where A is Element of F: not x in A & A in F};
      then consider A be Element of F such that
A11:    a = A\/{x} & not x in A & A in F;
      consider b be object such that
A12:    b in dom E & E.b = A by A11,A3,FUNCT_1:def 3;
      S.b = (E.b)\/{x} by Def4,A11,A12;
      hence thesis by A11,A12,A2,FUNCT_1:def 3;
    end;
  end;
  then
A13: swap(F,x,y) = rng S by A4;
A14: card swap(F,x,y) = card F by A1,Th11;
  card F = len E =len S by CARD_1:def 7;
  then S is one-to-one by A13,A14,FINSEQ_4:62;
  hence thesis by A13,RLAFFIN3:def 1;
end;
