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;
reserve
  B,A,M for BinOp of D,
  F,G for D* -valued FinSequence,
  f for FinSequence of D,
  d,d1,d2 for Element of D;
reserve
  F,G for non-empty non empty FinSequence of D*,
  f for non empty FinSequence of D;
reserve f,g for FinSequence of D,
        a,b,c for set,
        F,F1,F2 for finite set;

theorem Th134:
  for s be FinSequence st card (s"{y})=k
    ex p be Permutation of dom s,s1 be FinSequence st
      s*p = s1^(k|->y) & not y in rng s1
proof
  let s be FinSequence such that
A1: card (s"{y})=k;
  per cases;
  suppose
A2: k=0;
    take p=id dom s,s;
    s * p = s & k|->y ={}  by A2,RELAT_1:52;
    hence s*p = s^(k|->y);
    assume y in rng s;
    then consider x such that
A3: x in dom s & s.x =y by FUNCT_1:def 3;
    s.x in {y} by A3,TARSKI:def 1;
    then x in s"{y} by A3,FUNCT_1:def 7;
    hence thesis by A2,A1;
  end;
  suppose k<>0;
    then s"{y} is non empty by A1;
    then consider x such that
A4: x in s"{y};
    x in dom s & s.x in {y} by A4,FUNCT_1:def 7;
    then y = s.x in rng s by FUNCT_1:def 3,TARSKI:def 1;
    then reconsider L={y} as Subset of rng s by ZFMISC_1:31;
    L``=L;
    then consider p be Permutation of dom s such that
A5: (s-L)^(s-L`) = s*p by FINSEQ_3:115;
    take p,s1 = s-L;
    L` = (rng s) \L by SUBSET_1:def 4;
    then s"(L`) = s"(rng s) \ s"(L) by FUNCT_1:69;
    then s"(L`) = (dom s) \ s"(L) by RELAT_1:134;
    then card (s"(L`)) = card (dom s) -card  (s"(L)) by RELAT_1:132,CARD_2:44;
    then card (s"(L`)) = card (Seg len s) -card  (s"(L)) by FINSEQ_1:def 3;
    then
A6:len (s-L`) = len s - (len s - k) by A1,FINSEQ_3:59;
    rng (s-L`) = rng s \ L` by FINSEQ_3:65
    .= rng s \ (rng s \L) by SUBSET_1:def 4
    .= rng s /\L by XBOOLE_1:48
    .= L by XBOOLE_1:28;
    then s-L` = dom (s-L`) --> y by FUNCOP_1:9;
    hence s*p = s1^(k|->y) by A5,A6,FINSEQ_1:def 3;
    rng (s-L) = (rng s) \L & y in {y} by FINSEQ_3:65,TARSKI:def 1;
    hence thesis by XBOOLE_0:def 5;
  end;
end;
