reserve a,a1,a2,b,c,d for Ordinal,
  n,m,k for Nat,
  x,y,z,t,X,Y,Z for set;
reserve f,g for Function;
reserve A,B,C for array;

theorem
  x in dom A & y in dom A implies Swap(Swap(A,x,y),x,y) = A
  proof assume
A1: x in dom A & y in dom A;
    set B = Swap(A,x,y);
    set C = Swap(B,x,y);
A2: dom C = dom B & dom B = dom A by FUNCT_7:99;
    now let z be object;
      assume
      z in dom B;
      per cases;
      suppose
A3:     z <> x & z <> y;
        hence C.z = B.z by Th33 .= A.z by A3,Th33;
      end;
      suppose
A4:     z = x;
        hence C.z = B.y by A1,A2,Th29 .= A.z by A1,A4,Th31;
      end;
      suppose
A5:     z = y;
        hence C.z = B.x by A1,A2,Th31 .= A.z by A1,A5,Th29;
      end;
    end;
    hence C = A by A2;
  end;
