reserve A for non trivial Nat,
        B,C,n,m,k for Nat,
        e for Nat;
reserve a for non trivial Nat;

theorem Th14:
  for a,b,c,d be Nat st a <= b <= c & 2*c <= d & c > 0
    for f be FinSequence of REAL st
      len f = b-a+1 &
      for i be Nat st i+1 in dom f holds f.(i+1) =
         (c choose (a+i)) * (d |^(c-'(a+i)))
    holds
      0 < Sum f  < 2*(c|^a) * (d|^(c-'a))
proof
  defpred P[Nat] means
    for a,b,c,d be Nat st a <= b <= c & 2*c <= d  & c>0 & b-a=$1
    for f be FinSequence of REAL st len f = b-a+1 &
    for i be Nat st i+1 in dom f holds f.(i+1) =
    (c choose (a+i)) * (d |^(c-'(a+i))) holds
      0 <= 1-(c/d)|^(b+1-'a) &
      0 < Sum f <= (1-(c/d)|^(b+1-'a))/ (1-(c/d)) *c|^a* d|^(c-'a);
A1: P[0]
  proof
    let a,b,c,d be Nat such that A2: a <= b <= c & 2*c <= d & c > 0 & b-a=0;
A3:   d>0 by A2;
    let f be FinSequence of REAL such that
A4:   len f = b-a+1 and
A5:   for i be Nat st i+1 in dom f holds f.(i+1) =
        (c choose (a+i)) * (d |^(c-'(a+i)));
A6:    f.1 = (c choose (a+0)) * (d |^(c-'(a+0))) by A5,FINSEQ_3:25,A2,A4;
    then reconsider f1=f.1 as Nat;
    c-'a =c-a by A2,XREAL_1:233;
    then
A7:   c-'a+a = c;
A8:   f = <*f1*> by A2,A4,FINSEQ_1:40;
A9:   1-(c/d) > 0
    proof
      assume 1-(c/d)<=0;
      then 1 <= c/d by XREAL_1:50;
      then 1*d <= c/d*d by XREAL_1:64;
      then d<=c by XCMPLX_1:87;
      then c + c <=c+0 by A2,XXREAL_0:2;
      hence thesis by A2,XREAL_1:6;
    end;
    b+1 >a by A2,NAT_1:13;
    then b+1-'a = b+1-a by XREAL_1:233;
    then
A10: (1-(c/d)|^(b+1-'a))/ (1-(c/d)) = 1 by A2,A9,XCMPLX_1:60;
      c choose a <= (c|^a) / (a!)<= (c|^a)/ 1
      by NAT_1:14,XREAL_1:118,A2,HILB10_6:8;
    then c choose a <= c|^a by XXREAL_0:2;
    hence thesis by A3,A6,A8,A7,A9,A10,XREAL_1:64;
  end;
A11:P[n] implies P[n+1]
  proof
    assume
A12:  P[n];
    set n1=n+1;
    let a,b,c,d be Nat such that
A13:  a <= b <= c & 2*c <= d & c > 0 & b-a=n1;
A14:  d>0 by A13;
    let f be FinSequence of REAL such that
A15:  len f = b-a+1 and
A16:  for i be Nat st i+1 in dom f holds f.(i+1) =
    (c choose (a+i)) * (d |^(c-'(a+i)));
    set 1cd = 1-(c/d);
    b<>0 by A13;
    then reconsider B=b-1 as Nat;
    set F = f|n1;
    f = F ^ <* f.(n1+1) *> by A13,A15,FINSEQ_3:55;
    then
A17:  Sum f = (Sum F) + f.(n1+1) by RVSUM_1:74;
      c choose (a+n1) <= (c|^ (a+n1) ) / ((a+n1) !)<= (c|^(a+n1))/ 1
      by NAT_1:14,XREAL_1:118,A13,HILB10_6:8;
    then
A18:  c choose (a+n1) <= c|^(a+n1) by XXREAL_0:2;
    1<= n1+1 by NAT_1:11;
    then
A19:  f.(n1+1) = (c choose (a+n1)) * (d |^(c-'(a+n1)))
      by A16,A13,A15,FINSEQ_3:25;
    then
A20:  f.(n1+1) <= c|^(a+n1) * (d |^(c-'(a+n1))) by A18,XREAL_1:64;
A21:  n1 < n1+1 by NAT_1:13;
A22:  len F = B-a+1 by A21,A13,A15,FINSEQ_1:59;
A23:  for i be Nat st i+1 in dom F holds F.(i+1) =
       (c choose (a+i)) * (d |^(c-'(a+i)))
    proof
      let i be Nat such that
A24:    i+1 in dom F;
      i+1 in dom f & f.(i+1) = F.(i+1) by A24,RELAT_1:57,FUNCT_1:47;
      hence thesis by A16;
    end;
    B+1<=c by A13;
    then
A25:  B < c by NAT_1:13;
A26:  a<=a +n < a+n+1 by NAT_1:11,13;
A27:  0 < Sum F <= (1 -(c/d)|^(B+1-'a))/ (1cd) *c|^a* d|^(c-'a)
      by A12,A26,A13,A22,A23,A25;
    c/d*d =c by A14,XCMPLX_1:87;
    then
A28:  c|^n1 = ( (c/d) |^n1) * (d|^n1) by NEWTON:7;
    c-'(a+n1) = c -(a+n1) & c-'a = c-a by A13,XXREAL_0:2,XREAL_1:233;
    then
A29:  c-'a = n1 + (c-'(a+n1));
A30:  1cd > 0
    proof
      assume 1cd<=0;
      then 1 <= c/d by XREAL_1:50;
      then 1*d <= c/d*d by XREAL_1:64;
      then d<=c by XCMPLX_1:87;
      then c + c <=c+0 by A13,XXREAL_0:2;
      hence thesis by A13,XREAL_1:6;
    end;
A31:  ((1-(c/d) |^(B+1-'a))/ 1cd *c|^a* d|^(c-'a)) +
      ((c|^a)*( (c/d) |^n1) * d|^(c-'a) ) =
      (((1-(c/d)|^(B+1-'a))/1cd + (c/d) |^n1)) * (c|^a* d|^(c-'a));
A32: b-'a = n1 by A13,XREAL_1:233;
    a < b+1 by A13,NAT_1:13;
    then
A33:  b+1-'a = b+1-a by XREAL_1:233;
A34: ((1-(c/d)|^(B+1-'a)) + ((c/d) |^n1* 1cd))=
       (1-(c/d)|^n1) + (c/d) |^n1 - ( (c/d) |^n1 * (c/d)) by A32
      .= 1 - ( (c/d) |^(n1+1)) by NEWTON:6
      .= 1 - ( (c/d) |^(b+1-'a)) by A33,A13;
A35:(1-(c/d)|^(B+1-'a))/ 1cd + (c/d) |^n1 =
      (1-(c/d)|^(B+1-'a))/1cd + ((c/d) |^n1* 1cd) / 1cd by A30,XCMPLX_1:89
      .= ((1-(c/d)|^(B+1-'a)) + ((c/d) |^n1* 1cd)) / 1cd by XCMPLX_1:62;
    c|^(a+n1) * (d |^(c-'(a+n1))) =
      (c|^a)*(( (c/d) |^n1) * (d|^n1)) * (d |^(c-'(a+n1)))
      by NEWTON:8,A28
    .= (c|^a)*( (c/d) |^n1) * ((d|^n1) * (d |^(c-'(a+n1))))
    .= (c|^a)*( (c/d) |^n1) * d|^(c-'a) by A29,NEWTON:8;
    hence thesis by A19,A35,A17,A27,A20, A30,A34,XREAL_1:7,A31;
  end;
  let a,b,c,d be Nat such that
A36: a <= b <= c & 2*c <= d & c >0;
A37: d>0 by A36;
  let f be FinSequence of REAL such that
A38: len f = b-a+1 &
     for i be Nat st i+1 in dom f holds f.(i+1) =
       (c choose (a+i)) * (d |^(c-'(a+i)));
  reconsider ba=b-a as Nat by A36,NAT_1:21;
  P[n] from NAT_1:sch 2(A1,A11);
  then
A39: P[ba];
  then
A40: 0 < Sum f <= (1-(c/d)|^(b+1-'a))/ (1-(c/d)) *c|^a* d|^(c-'a) by A36,A38;
A41: (1-(c/d)|^(b+1-'a))>=0 by A36,A38,A39;
  2*c <= d*1 by A36;
  then c/d <=1/2 by A37,XREAL_1:102;
  then 1 - c/d >= 1 - 1/2 by XREAL_1:10;
  then
A42: (1-(c/d)|^(b+1-'a))/ (1-(c/d)) <= (1-(c/d)|^(b+1-'a)) /(1/2)
    by A41,XREAL_1:118;
  1-(c/d)|^(b+1-'a) < 1-0 by A36,A37,XREAL_1:10;
  then (1-(c/d)|^(b+1-'a))*2 < (1-0)*2 by XREAL_1:68;
  then (1-(c/d)|^(b+1-'a))/ (1-(c/d)) < 2 by A42,XXREAL_0:2;
  then (1-(c/d)|^(b+1-'a))/ (1-(c/d)) *(c|^a* d|^(c-'a)) < 2*(c|^a* d|^(c-'a))
    by A36,A37,XREAL_1:68;
  hence thesis by A40,XXREAL_0:2;
end;
