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 Th47:
  f|A is bounded implies upper_integral(f) >= lower_integral(f)
proof
  assume
A1: f|A is bounded;
A2: for b be Real st b in rng upper_sum_set(f) holds lower_integral(f
  ) <= b
  proof
    let b be Real;
    assume b in rng upper_sum_set(f);
    then consider D1 being Element of divs A such that
 D1 in dom upper_sum_set(f) and
A3: b=(upper_sum_set(f)).D1 by PARTFUN1:3;
    reconsider D1 as Division of A by Def2;
A4: for a being Real st a in rng lower_sum_set(f) holds a <=
    upper_sum(f,D1)
    proof
      let a be Real;
      assume a in rng lower_sum_set(f);
      then consider D2 being Element of divs A such that
   D2 in dom lower_sum_set(f) and
A5:   a=(lower_sum_set(f)).D2 by PARTFUN1:3;
      reconsider D2 as Division of A by Def2;
      a=lower_sum(f,D2) by A5,Def10;
      hence thesis by A1,Th46;
    end;
    b=upper_sum(f,D1) by A3,Def9;
    hence thesis by A4,SEQ_4:45;
  end;
  thus thesis by A2,SEQ_4:43;
end;
