
theorem NF530:
  for a being non empty positive FinSequence of REAL,
  Alg being Function of [:REAL, NAT*:],NAT,
  h being non empty FinSequence of NAT* st
  h = OnlinePackingHistory(a, Alg) holds
  (for i, l being Nat st
  1 <= i & i < len a holds
  SumBin (a, h . i, {l}) <= SumBin (a, h . (i + 1), {l}))
  proof
    let a be non empty positive FinSequence of REAL,
    Alg be Function of [:REAL, NAT*:],NAT,
    h be non empty FinSequence of NAT*;

    assume HC00: h = OnlinePackingHistory(a, Alg);

    let i, l be Nat;

    assume that
    L000: 1 <= i and
    L001: i < len a;
    L120: h . i is FinSequence of NAT by HC00,L000,L001,NF505;
    L147: i + 1 <= len a by L001,NAT_1:13;
    then L150: len (h . i) + 1 <= len a by HC00,L000,L001,NF510;

    i + 1 in dom a by L147,XREAL_1:38,FINSEQ_3:25;
    then a . (i + 1) in rng a by FUNCT_1:3;
    then reconsider aip = a . (i + 1) as Element of REAL;

    reconsider hi = h . i as Element of NAT* by L120,FINSEQ_1:def 11;

    L190: Alg . (aip, hi) is Nat;

    per cases;
    suppose L200: Alg . (a . (i + 1), h . i) = l;
      L279: SumBin (a, h . (i + 1), {l})
       = SumBin (a, (h . i) ^ <* Alg . (a . (i + 1), h . i) *>, {l})
      by HC00,L000,L001,NF520
      .= SumBin (a, h . i, {l}) +  a . (len (h . i) + 1)
      by L120,L150,L200,NF200;

      len (h . i) + 1 in dom a by XREAL_1:38,L150,FINSEQ_3:25;
      hence thesis by L279,RVSUM_3:def 1,XREAL_1:29;
    end;
    suppose L500: Alg . (a . (i + 1), h . i) <> l;
      reconsider b = Alg . (a . (i + 1), h . i) as Nat by L190;

      SumBin (a, h . (i + 1), {l})
      =  SumBin (a, (h . i) ^ <* b *>, {l}) by HC00,L000,L001,NF520
      .= SumBin (a, h . i, {l}) by L120,L500,NF110;
      hence thesis;
    end;
  end;
