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 Th36:
  for f be Function st z in dom f holds Swap(<*f.z*>,x,y) = <*Swap(f,x,y).z*>
proof
  let f be Function;
  assume
A1:  z in dom f;
A2:  1 in Seg 1;
A3:  dom Swap(<*f.z*>,x,y) = dom <*f.z*> = Seg 1 by Def4,FINSEQ_1:38;
  then
A4: len Swap(<*f.z*>,x,y) = len <*f.z*> =1 by FINSEQ_3:29,FINSEQ_1:40;
A5: <*f.z*>.1 = f.z;
  per cases;
  suppose x in f.z;
    then Swap(<*f.z*>,x,y).1 = ((f.z)\{x})\/{y} = Swap(f,x,y).z
      by A2,Def4,A3,A5,A1;
    hence thesis by A4,FINSEQ_1:40;
  end;
  suppose not x in f.z;
    then Swap(<*f.z*>,x,y).1 = (f.z)\/{x} = Swap(f,x,y).z by A2,Def4,A3,A5,A1;
    hence thesis by A4,FINSEQ_1:40;
  end;
end;
