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;
reserve O for connected non empty Poset;
reserve R,Q for array of O;

theorem Th53:
  [x,y] in inversions R implies
  ([z,y] in inversions R & z in x iff [z,x] in inversions Swap(R,x,y))
  proof set s = Swap(R,x,y);
    assume [x,y] in inversions R; then
A1: x in dom R & y in dom R & x in y & R/.x > R/.y by Th46; then
A2: s/.x = R/.y & s/.y = R/.x & dom s = dom R by Th30,Th32,FUNCT_7:99;
    hereby assume
A3:   [z,y] in inversions R & z in x; then
A4:   z in dom R & z in y & R/.z > R/.y by Th46; then
      x <> z & y <> z by A3; then
      s/.z = R/.z by A4,Th34;
      hence [z,x] in inversions Swap(R,x,y) by A3,A1,A2,A4;
    end;
    assume [z,x] in inversions Swap(R,x,y); then
A5: z in dom R & z in x & s/.z > s/.x by A2,Th46; then
A6: z in y by A1,ORDINAL1:10;
    s/.z = R/.z by A1,A5,Th34;
    hence thesis by A1,A2,A5,A6;
  end;
