reserve a,a1,b,b1,x,y for Real,
  F,G,H for FinSequence of REAL,
  i,j,k,n,m for Element of NAT,
  I for Subset of REAL,
  X for non empty set,
  x1,R,s for set;
reserve A for non empty closed_interval Subset of REAL;
reserve A, B for non empty closed_interval Subset of REAL;
reserve r for Real;
reserve D, D1, D2 for Division of A;
reserve f, g for Function of A,REAL;

theorem Th25:
  f|A is bounded_above implies
  upper_sum(f,D) <= (upper_bound rng f)*vol(A)
proof
  assume
A1: f|A is bounded_above;
A2: for i st i in Seg(len D) holds (upper_bound rng f)*vol(divset(D,i)) >= (
  upper_bound rng (f|divset(D,i)))*vol(divset(D,i))
  proof
    let i;
A3: rng(f|divset(D,i)) c= rng f by RELAT_1:70;
A4: 0 <= vol(divset(D,i)) by SEQ_4:11,XREAL_1:48;
    assume i in Seg(len D); then
A5: i in dom D by FINSEQ_1:def 3;
    dom f = A by FUNCT_2:def 1;
    then dom (f|divset(D,i)) = divset(D,i) by A5,Th6,RELAT_1:62;
    then
A6: rng(f|divset(D,i)) is non empty Subset of REAL by RELAT_1:42;
    rng f is bounded_above by A1,Th11;
    hence thesis by A3,A6,A4,SEQ_4:48,XREAL_1:64;
  end;
A7: for i st i in Seg(len D) holds (upper_bound rng f)*(upper_volume(chi(A,
  A),D).i) >= (upper_bound rng (f|divset(D,i)))*vol(divset(D,i))
  proof
    let i;
    assume
A8: i in Seg(len D); then
A9: i in dom D by FINSEQ_1:def 3;
    (upper_bound rng f)*vol(divset(D,i)) >= (upper_bound rng (f|divset(D,
    i)))*vol(divset(D,i)) by A2,A8;
    hence thesis by A9,Th18;
  end;
  Sum((upper_bound rng f)*upper_volume(chi(A,A),D)) >=Sum(upper_volume(f,
  D))
  proof
    len (upper_volume(chi(A,A),D)) = len ((upper_bound rng f)*
    upper_volume(chi(A,A),D)) by FINSEQ_2:33;
    then
A10: len ((upper_bound rng f)*upper_volume(chi(A,A),D))=len D by Def5;
    deffunc G(Nat)=
       In((upper_bound rng (f|divset(D,$1)))*vol(divset(D,$1)),REAL);
    deffunc
       F(set)=In((upper_bound rng f)*(upper_volume(chi(A,A),D).$1),REAL);
    consider p being FinSequence of REAL such that
A11: len p = len D & for i be Nat st i in dom p holds p.i=F(i) from
    FINSEQ_2:sch 1;
A12: dom p = Seg len D by A11,FINSEQ_1:def 3;
    for i be Nat st 1 <= i & i <= len p holds p.i=((upper_bound rng f)*
    upper_volume(chi(A,A),D)).i
    proof
      let i be Nat;
      assume that
A13:  1 <= i and
A14:  i <= len p;
      i in Seg(len D) by A11,A13,A14,FINSEQ_1:1;
      then p.i=F(i) by A11,A12;
      hence thesis by RVSUM_1:44;
    end;
    then
A15: p=(upper_bound rng f)*upper_volume(chi(A,A),D) by A11,A10,FINSEQ_1:14;
    reconsider p as Element of (len D)-tuples_on REAL by A11,FINSEQ_2:92;
    consider q being FinSequence of REAL such that
A16: len q = len D & for i be Nat st i in dom q holds q.i=G(i) from
    FINSEQ_2:sch 1;
A17: for i be Nat st i in dom q holds q.i=
      (upper_bound rng (f|divset(D,i)))*vol(divset(D,i))
    proof let i be Nat;
     assume i in dom q;
      then q.i=G(i) by A16;
     hence thesis;
    end;
A18: dom q = dom D by A16,FINSEQ_3:29;
    then
A19: q=upper_volume(f,D) by A16,Def5,A17;
    reconsider q as Element of (len D)-tuples_on REAL by A16,FINSEQ_2:92;
    now
      let i be Nat;
      assume
A20:  i in Seg (len D);
      then i in dom D by FINSEQ_1:def 3;
      then
A21:  q.i=G(i) by A16,A18;
      p.i=F(i) by A11,A12,A20;
      hence q.i <= p.i by A7,A20,A21;
    end;
    hence thesis by A19,A15,RVSUM_1:82;
  end;
  then
  (upper_bound rng f)*Sum(upper_volume(chi(A,A),D))>= Sum(upper_volume(f,
  D)) by RVSUM_1:87;
  hence thesis by Th22;
end;
