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