reserve a,x,y for object, A,B for set,
  l,m,n for Nat;
reserve X,Y for set, x for object,
  p,q for Function-yielding FinSequence,
  f,g,h for Function;
reserve m,n,k for Nat, R for Relation;
reserve i,j for Nat;
reserve F for Function,
  e,x,y,z for object;

theorem
 for x,y being object holds rng Swap(F,x,y) = rng F
proof let x,y be object;
  per cases;
  suppose that
A1: x in dom F and
A2: y in dom F;
    F.x in rng F by A1,FUNCT_1:3;
    then F.x in rng F \/ {F.y} by XBOOLE_0:def 3;
    then rng F \/ {F.y} \/ {F.x} = rng F \/ {F.y} by ZFMISC_1:40
      .= rng F by A2,FUNCT_1:3,ZFMISC_1:40;
    then
A3: rng(F+*(x,F.y)) \/ {F.x} c= rng F by Th99,XBOOLE_1:9;
A4: (F+*(x,F.y)).y = F.y
    proof
      per cases;
      suppose
        x <> y;
        hence thesis by Th31;
      end;
      suppose
        x = y;
        hence thesis by A1,Th30;
      end;
    end;
A5: rng F c= rng(F+*(x,F.y)) \/ {F.x} by Th100;
A6: Swap(F,x,y) = F+*(x,F.y)+*(y,F.x) by A1,A2,Def11;
    then rng Swap(F,x,y) c= rng(F+*(x,F.y)) \/ {F.x} by Th99;
    then
A7: rng Swap(F,x,y) c= rng F by A3;
A8: y in dom(F+*(x,F.y)) by A2,Th29;
A9: F.y in rng Swap(F,x,y)
    proof
      per cases;
      suppose
        F.x = F.y;
        hence thesis by A6,A8,Th101;
      end;
      suppose
A10:    F.x <> F.y;
A11:    dom Swap(F,x,y) = dom F by Th98;
        Swap(F,x,y).x = F+*(x,F.y).x by A6,A10,Th31
          .= F.y by A1,Th30;
        hence thesis by A1,A11,FUNCT_1:3;
      end;
    end;
    F.x in rng Swap(F,x,y) by A6,A8,Th101;
    then F.x in rng Swap(F,x,y) \/ {F.y} by XBOOLE_0:def 3;
    then rng Swap(F,x,y) \/ {F.y} \/ {F.x} = rng Swap(F,x,y) \/ {F.y} by
ZFMISC_1:40
      .= rng Swap(F,x,y) by A9,ZFMISC_1:40;
    then rng(F+*(x,F.y)) \/ {F.x} c= rng Swap(F,x,y) by A6,A4,Th100,XBOOLE_1:9;
    then rng F c= rng Swap(F,x,y) by A5;
    hence thesis by A7;
  end;
  suppose
    not(x in dom F & y in dom F);
    hence thesis by Def11;
  end;
end;
