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 Th23:
  for f,g be Function holds Swap(f,x,y)*g = Swap(f*g,x,y)
proof
  let f,g be Function;set S=Swap(f,x,y),Sg=Swap(f*g,x,y);
A1: dom S = dom f & dom Sg = dom (f*g) by Def4;
A2: dom (S*g) c= dom (f*g)
  proof
    let a be object;
    assume a in dom (S*g);
    then a in dom g & g.a in dom S by FUNCT_1:11;
    hence thesis by A1,FUNCT_1:11;
  end;
  dom (f*g) c= dom (S*g)
  proof
    let a be object;assume a in dom (f*g);
    then a in dom g & g.a in dom f by FUNCT_1:11;
    hence thesis by A1,FUNCT_1:11;
  end;
  then
A3: dom Sg = dom (S*g) by A2,Def4;
  for a st a in dom Sg holds Sg.a = (S*g).a
  proof
    let a such that
A4:   a in dom Sg;
A5:   a in dom (f*g) by A4,Def4;
    then
A6:   (f*g).a = f.(g.a) by FUNCT_1:12;
A7:   (S*g).a = S.(g.a) & g.a in dom S by A4,A3,FUNCT_1:11,12;
    per cases;
    suppose
A8:     x in (f*g).a;
      then Sg.a = (((f*g).a)\{x})\/{y} by A5,Def4;
      hence thesis by A6,A7,A8,A1,Def4;
    end;
    suppose
A9:     not x in (f*g).a;
      then Sg.a = ((f*g).a)\/{x} by A5,Def4;
      hence thesis by A9,A6,A7,A1,Def4;
    end;
  end;
  hence thesis by A3;
end;
