
theorem NF510:
  for a being non empty 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 being Nat st 1 <= i & i <= len a holds len (h . i) = i)
  proof
    let a be non empty FinSequence of REAL,
    Alg be Function of [:REAL, NAT*:],NAT,
    h be non empty FinSequence of NAT*;

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

    defpred P[Nat] means
    len (h . $1) = $1;

    h . 1 = <* 1 *> by L00,defPackHistory;
    then L05: P[1] by FINSEQ_1:39;

    L08:for i being Element of NAT st 1 <= i & i < len a & P[i] holds
    P[i+1]
    proof
      let im be Element of NAT;

      assume that
      L10: 1 <= im & im < len a and
      L15: len (h . im) = im;

      consider d1 being Element of REAL, d2 being FinSequence of NAT
      such that
      L20: d1 = a . (im + 1) & d2 = h . im and
      L30: h . (im + 1) = d2 ^ <* Alg . (d1, d2) *>
      by L00,L10,defPackHistory;

      len (h . (im + 1))
      = len (h . im) + len (<* Alg . (a . (im + 1), h . im) *>)
      by L20,L30,FINSEQ_1:22
      .= im + 1 by FINSEQ_1:39,L15;
      hence thesis;
    end;

    L800: for i being Element of NAT st 1 <= i & i <= len a holds P[i]
    from INT_1:sch 7(L05,L08);

    for i being Nat st 1 <= i & i <= len a holds P[i]
    proof
      let i be Nat;

      assume that
      L810: 1 <= i and
      L811: i <= len a;

      i in NAT by ORDINAL1:def 12;
      hence thesis by L810,L811,L800;
    end;
    hence thesis;
  end;
