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 Th15:
  for F be PartFunc of D,REAL, A be RearrangmentGen of C st F is
  total & card C = card D holds rng Rland(F,A) = rng FinS(F,D)
proof
  let F be PartFunc of D,REAL, B be RearrangmentGen of C;
  assume that
A1: F is total and
A2: card C = card D;
  set fd = FinS(F,D), p = Rland(F,B), mf = MIM(fd), h = CHI(B,C);
A3: len mf = len h by A1,A2,Th11;
A4: dom F = D by A1,PARTFUN1:def 2;
  then reconsider fd9 = fd, F9 = F as finite Function by FINSET_1:10;
  reconsider dfd = dom fd9, dF = dom F9 as finite set;
A5: len h = len B & len mf = len fd by RFINSEQ:def 2,RFUNCT_3:def 6;
A6: dom p = C by A1,A2,Th12;
A7: dom fd = Seg len fd by FINSEQ_1:def 3;
A8: dom B = Seg len B by FINSEQ_1:def 3;
  F|D = F by A4,RELAT_1:68;
  then fd, F are_fiberwise_equipotent by A4,RFUNCT_3:def 13;
  then card dfd = card dF by CLASSES1:81;
  then len fd <> 0 by A4,A7;
  then
A9: 0+1<=len fd by NAT_1:13;
  then
A10: 1 in dom fd by FINSEQ_3:25;
  thus rng p c= rng fd
  proof
    let x be object;
    assume x in rng p;
    then consider c be Element of C such that
    c in dom p and
A11: p.c = x by PARTFUN1:3;
    defpred P[set] means $1 in dom B & c in B.$1;
A12: ex n be Nat st P[n]
    proof
      take n = len B;
      B.n = C by Th3;
      hence thesis by A3,A5,A9,FINSEQ_3:25;
    end;
    consider mi be Nat such that
A13: P[mi] & for n be Nat st P[n] holds mi<=n from NAT_1:sch 5(A12);
A14: 1<=mi by A13,FINSEQ_3:25;
    then max(0,mi-1)=mi-1 by FINSEQ_2:4;
    then reconsider m1 = mi -1 as Element of NAT by FINSEQ_2:5;
A15: mi<=len B by A13,FINSEQ_3:25;
    now
      per cases;
      case
        mi = 1;
        then p.c = fd.1 by A1,A2,A13,Th14;
        hence thesis by A10,A11,FUNCT_1:def 3;
      end;
      case
        mi <> 1;
        then 1<mi by A14,XXREAL_0:1;
        then 1+1<=mi by NAT_1:13;
        then
A16:    1<=m1 by XREAL_1:19;
A17:    m1<mi by XREAL_1:44;
        then m1<=len B by A15,XXREAL_0:2;
        then m1 in dom B by A16,FINSEQ_3:25;
        then not c in B.m1 by A13,XREAL_1:44;
        then
A18:    c in B.(m1+1) \ B.m1 by A13,XBOOLE_0:def 5;
        m1<len B by A15,A17,XXREAL_0:2;
        then p.c = fd.(m1+1) by A1,A2,A16,A18,Th14;
        hence thesis by A3,A5,A7,A8,A11,A13,FUNCT_1:def 3;
      end;
    end;
    hence thesis;
  end;
  let x be object;
  defpred P[Nat] means $1 in dom fd & fd.$1 = x;
  assume x in rng fd;
  then
A19: ex n be Nat st P[n] by FINSEQ_2:10;
  consider mi be Nat such that
A20: P[mi] & for n be Nat st P[n] holds mi<=n from NAT_1:sch 5(A19);
A21: 1<=mi by A20,FINSEQ_3:25;
  then max(0,mi-1)=mi-1 by FINSEQ_2:4;
  then reconsider m1 = mi -1 as Element of NAT by FINSEQ_2:5;
A22: mi<=len fd by A20,FINSEQ_3:25;
  now
    per cases;
    case
A23:  mi=1;
      set y = the Element of B.1;
A24:  B.1 <> {} by A3,A5,A7,A8,A10,Th7;
      B.1 c= C by A3,A5,A7,A8,A10,Lm5;
      then reconsider y as Element of C by A24;
      p.y = fd.1 by A1,A2,A24,Th14;
      hence thesis by A6,A20,A23,FUNCT_1:def 3;
    end;
    case
A25:  mi<>1;
      set y = the Element of B.(m1+1) \ B.m1;
      1<mi by A21,A25,XXREAL_0:1;
      then 1+1<=mi by NAT_1:13;
      then
A26:  1<=m1 by XREAL_1:19;
      m1+1<=len fd by A20,FINSEQ_3:25;
      then m1<=len fd -1 by XREAL_1:19;
      then
A27:  B.(m1+1) \ B.m1 <> {} by A3,A5,A26,Th8;
      then
A28:  y in B.(m1+1) by XBOOLE_0:def 5;
      B.mi c= C by A3,A5,A7,A8,A20,Lm5;
      then reconsider y as Element of C by A28;
      m1<mi by XREAL_1:44;
      then m1<len fd by A22,XXREAL_0:2;
      then p.y=fd.(m1+1) by A1,A2,A3,A5,A26,A27,Th14;
      hence thesis by A6,A20,FUNCT_1:def 3;
    end;
  end;
  hence thesis;
end;
