 reserve X,Y for set,
         n,m,k,i for Nat,
         r for Real,
         R for Element of F_Real,
         K for Field,
         f,f1,f2,g1,g2 for FinSequence,
         rf,rf1,rf2 for real-valued FinSequence,
         cf,cf1,cf2 for complex-valued FinSequence,
         F for Function;

theorem Th9:
  for f,f1 be FinSubsequence for P be Permutation of dom f st f1 = f*P
   ex Q be Permutation of dom Seq(f1|P"X) st Seq(f|X) = Seq(f1|P"X) * Q
proof
  let f,f1 be FinSubsequence;
  consider n be Nat such that
   A1: dom f c=Seg n by FINSEQ_1:def 12;
  let P be Permutation of dom f such that
   A2: f1=f*P;
  set SPX=Sgm(P"X);
  A3: P"X c=dom P by RELAT_1:132;
  then A4: dom(P|P"X)=P"X by RELAT_1:62;
  A5: dom P=dom f by FUNCT_2:52;
  then P"X c= Seg n by A1,A3;
  then
a1: P"X is included_in_Seg;
  then
A6: SPX is one-to-one by FINSEQ_3:92;
  set dfX=dom f/\X;
  set SdX=Sgm dfX;
  A8: rng SdX=dfX by FINSEQ_1:def 14;
  A9: rng P=dom f by FUNCT_2:def 3;
  then A10: P"X=P"dfX by RELAT_1:133;
  then A11: P"X=(P").:dfX by FUNCT_1:85;
  set PS=(P|P"X)*SPX;
A12: P|P"X is one-to-one by FUNCT_1:52;
  P"X c=Seg n by A1,A5,A3;
  then P"X is included_in_Seg;
  then A13: rng SPX=P"X by FINSEQ_1:def 14;
  rng(P|P"X)=P.:(P"dfX) by A10,RELAT_1:115
   .=dfX by A9,FUNCT_1:77,XBOOLE_1:17;
  then A14: rng PS=dfX by A4,A13,RELAT_1:28;
  A15: dom((PS qua Function)")=dfX by A6,A12,A14,FUNCT_1:33;
  dom(P")=rng P by FUNCT_1:33;
  then dfX,(P").:dfX are_equipotent by A9,CARD_1:33,XBOOLE_1:17;
  then card dfX=card(P"X) by A11,CARD_1:5;
  then A16: dom SPX=Seg card dfX by a1,FINSEQ_3:40;
  then dom PS=Seg card dfX by A4,A13,RELAT_1:27;
  then rng((PS qua Function)")=Seg card dfX by A6,A12,FUNCT_1:33;
  then A17: rng(((PS qua Function)")*SdX)=Seg card dfX by A15,A8,RELAT_1:28;
  dom f1=dom P by A2,A9,RELAT_1:27;
  then A18: dom(f1|P"X)=P"X by RELAT_1:62,132;
  then A19: dom Seq(f1|P"X)=Seg card dfX by A16,A13,RELAT_1:27;
  dom SdX=Seg card dfX by FINSEQ_3:40;
  then dom(((PS qua Function)")*SdX)=Seg card dfX by A15,A8,RELAT_1:27;
  then reconsider PSS=((PS qua Function)")*SdX
   as Function of dom Seq(f1|P"X),dom Seq(f1|P"X)
    by A19,A17,FUNCT_2:1;
A20: PSS is onto by A19,A17,FUNCT_2:def 3;
  SdX is one-to-one by FINSEQ_3:92;
  then reconsider PSS as Permutation of dom Seq(f1|P"X) by A6,A12,A20;
  A21: PS*PSS=(PS*(PS qua Function)")*SdX by RELAT_1:36
   .=(id dfX)*SdX by A6,A12,A14,FUNCT_1:39;
  set fX=f|X;
  A22: fX=f|dfX by RELAT_1:157;
  take PSS;
  f1|P"X=f*(P|P"X) by A2,RELAT_1:83;
  hence Seq(f1|P"X)*PSS=f*PS*PSS by A18,RELAT_1:36
   .=f*((id dfX)*SdX) by A21,RELAT_1:36
   .=(f*(id dfX))*SdX by RELAT_1:36
   .=fX*SdX by A22,RELAT_1:65
   .=Seq fX by RELAT_1:61;
end;
