reserve n,m,k for Nat,
  x,y for set,
  r for Real;
reserve C,D for non empty finite set,
  a for FinSequence of bool D;

theorem
  for F be PartFunc of D,REAL, A be RearrangmentGen of C st F is total &
card D = card C & n in dom A holds FinS(Rland(F,A),C) | n = FinS(Rland(F,A),A.n
  )
proof
  let F be PartFunc of D,REAL, B be RearrangmentGen of C;
  assume that
A1: F is total & card D = card C and
A2: n in dom B;
  set p = Rland(F,B);
A3: len FinS(p,C) = card C by A1,Th30;
  defpred P[Nat] means $1 in dom B implies FinS(Rland(F,B),C) | $1
  = FinS(Rland(F,B),B.$1);
A4: len B = card C by Th1;
A5: dom B = Seg len B & dom FinS(p,C) = Seg len FinS(p,C) by FINSEQ_1:def 3;
A6: for m st P[m] holds P[m+1]
  proof
    set f = FinS(p,C);
    let m;
    assume
A7: P[m];
A8: m<=m+1 by NAT_1:11;
    assume
A9: m+1 in dom B;
    then 1<=m+1 by FINSEQ_3:25;
    then
A10: m+1 in Seg(m+1) by FINSEQ_1:1;
A11: dom p = C by A1,Th12;
A12: m+1<=len B by A9,FINSEQ_3:25;
    then
A13: m<=len B by NAT_1:13;
A14: m<len B by A12,NAT_1:13;
A15: m<=len B - 1 by A12,XREAL_1:19;
A16: len (f|(m+1)) = m+1 by A4,A3,A12,FINSEQ_1:59;
    now
      per cases;
      case
A17:    m=0;
        consider d be Element of C such that
A18:    B.1 = {d} by Th9;
A19:    d in B.1 by A18,TARSKI:def 1;
A20:    1<=len FinS(p,C) by A1,Th30;
        then 1 in Seg 1 & 1 in dom FinS(p,C) by FINSEQ_1:1,FINSEQ_3:25;
        then
A21:    (FinS(p,C)|(m+1)).1 = FinS(p,C).1 by A17,RFINSEQ:6
          .= FinS(F,D).1 by A1,Th17
          .= p.d by A1,A19,Th14;
        dom p = C by A1,Th12;
        then
A22:    FinS(p, B.(m+1)) = <* p.d *> by A17,A18,RFUNCT_3:69;
        len(FinS(p,C)|(m+1)) = 1 by A17,A20,FINSEQ_1:59;
        hence thesis by A22,A21,FINSEQ_1:40;
      end;
      case
A23:    m<>0;
A24:    Seg m c= Seg(m+1) by A8,FINSEQ_1:5;
A25:    (f|(m+1))|m = (f|(m+1))|(Seg m) by FINSEQ_1:def 16
          .= (f|Seg(m+1))|(Seg m) by FINSEQ_1:def 16
          .= f|(Seg(m+1) /\ (Seg m)) by RELAT_1:71
          .= f|(Seg m) by A24,XBOOLE_1:28
          .= f|m by FINSEQ_1:def 16;
A26:    0+1<=m by A23,NAT_1:13;
        then consider d be Element of C such that
A27:    B.(m+1) \ B.m = {d} and
        B.(m+1) = B.m \/ {d} and
A28:    B.(m+1) \ {d} = B.m by A15,Th10;
A29:    d in {d} by TARSKI:def 1;
        then p.d = FinS(F,D).(m+1) by A1,A14,A26,A27,Th14
          .= FinS(p,C).(m+1) by A1,Th17
          .=(f|(m+1)).(m+1) by A5,A4,A3,A9,A10,RFINSEQ:6;
        then
A30:    f|(m+1) = f|m ^ <*p.d*> by A16,A25,RFINSEQ:7;
        d in dom p /\ B.(m+1) by A11,A27,A29,XBOOLE_0:def 4;
        then
A31:    d in dom(p|(B.(m+1))) by RELAT_1:61;
A32:    (f|(m+1)) is non-increasing by RFINSEQ:20;
A33:    dom(p|(B.(m+1))) = dom p /\ (B.(m+1)) by RELAT_1:61
          .= B.(m+1) by A9,A11,Lm5,XBOOLE_1:28;
        B.(m+1) is finite by A9,Lm5,FINSET_1:1;
        then
        f|(m+1), p|(B.(m+1)) are_fiberwise_equipotent
          by A7,A13,A26,A28,A30,A31,FINSEQ_3:25,RFUNCT_3:65;
        hence thesis by A33,A32,RFUNCT_3:def 13;
      end;
    end;
    hence thesis;
  end;
A34: P[ 0 ] by FINSEQ_3:25;
  for m holds P[m] from NAT_1:sch 2(A34,A6);
  hence thesis by A2;
end;
