
theorem Th16:
for f be PartFunc of REAL,REAL, a be Real
 st right_closed_halfline(a) c= dom f & f is_+infty_ext_Riemann_integrable_on a
  holds for b be Real st a <= b holds f is_+infty_ext_Riemann_integrable_on b
proof
    let f be PartFunc of REAL,REAL, a be Real;
    assume that
A1:  right_closed_halfline(a) c= dom f and
A2:  f is_+infty_ext_Riemann_integrable_on a;

    hereby let b be Real;
     assume A3: a <= b;

A4:  for c be Real st b <= c holds
       f is_integrable_on ['b,c'] & f|['b,c'] is bounded
     proof
      let c be Real;
      assume A5: b <= c; then
      a <= c by A3,XXREAL_0:2; then
A6:   f is_integrable_on ['a,c'] & f|['a,c'] is bounded by A2,INTEGR10:def 5;
      ['a,c'] = [.a,c.] by A5,A3,XXREAL_0:2,INTEGRA5:def 3; then
      ['a,c'] c= [.a,+infty.[ by XXREAL_1:251; then
      ['a,c'] c= dom f by A1;
      hence thesis by A3,A5,A6,INTEGRA6:18;
     end;

     consider I be PartFunc of REAL,REAL such that
A7:   dom I = right_closed_halfline(a) and
A8:   for x be Real st x in dom I holds I.x = integral(f,a,x) and
A9:  I is convergent_in+infty by A2,INTEGR10:def 5;

     b < +infty by XREAL_0:def 1,XXREAL_0:9; then
     reconsider B = [.b,+infty.[ as non empty Subset of REAL
       by XXREAL_1:3;

     deffunc F(Element of B) = In(integral(f,b,$1),REAL);
     consider Intf be Function of B, REAL such that
A10:  for x being Element of B holds Intf.x = F(x) from FUNCT_2:sch 4;

A11: dom Intf = B by FUNCT_2:def 1; then
     reconsider Intf as PartFunc of REAL,REAL by RELSET_1:5;
A12:  dom Intf = right_closed_halfline(b) by FUNCT_2:def 1;
A13:  for x be Real st x in dom Intf holds Intf.x = integral(f,b,x)
     proof
      let x be Real;
      assume x in dom Intf; then
      Intf.x = In(integral(f,b,x),REAL) by A10,A11;
      hence Intf.x = integral(f,b,x);
     end;

A14:  for r be Real ex g be Real st r<g & g in dom Intf
     proof
      let r be Real;
      consider g be Real such that
A15:    max(b,r) < g by XREAL_1:1;
A16:   g < +infty by XXREAL_0:9,XREAL_0:def 1;
      r <= max(b,r) & b <= max(b,r) by XXREAL_0:25; then
A17:   r < g & b < g by A15,XXREAL_0:2; then
      g in [.b,+infty.[ by A16,XXREAL_1:3;
      hence thesis by A11,A17;
     end;

     consider G be Real such that
A18:   for g1 be Real st 0<g1
       ex r be Real st
        for r1 be Real st r<r1 & r1 in dom I holds |. I.r1-G .| < g1
          by A9,LIMFUNC1:44;

     set G1=G-integral(f,a,b);

     for g1 be Real st 0<g1
      ex r be Real st
       for r1 be Real st r<r1 & r1 in dom Intf holds
        |. Intf.r1 - G1 .| < g1
     proof
      let g1 be Real;
      assume 0 < g1; then
      consider R be Real such that
A19:    for r1 be Real st R < r1 & r1 in dom I holds |. I.r1-G .| < g1
         by A18;
      take R;
      thus for r1 be Real st R<r1 & r1 in dom Intf holds
       |. Intf.r1 - G1 .| < g1
      proof
       let r1 be Real;
       assume that
A20:     R < r1 and
A21:     r1 in dom Intf;

A22:   [.b,+infty.[ c= [.a,+infty.[ by A3,XXREAL_1:38;

A23:    b <= r1 by A21,A11,XXREAL_1:3; then
A24:    a <= r1 by A3,XXREAL_0:2; then
A25:    f is_integrable_on ['a,r1'] & f|['a,r1'] is bounded
         by A2,INTEGR10:def 5;

A26:    ['a,r1'] = [.a,r1.] by A23,A3,XXREAL_0:2,INTEGRA5:def 3; then
       ['a,r1'] c= [.a,+infty.[ by XXREAL_1:251; then
A27:    ['a,r1'] c= dom f by A1;
A28:    b in ['a,r1'] by A3,A23,A26,XXREAL_1:1;
A29:    integral(f,a,b) + integral(f,b,r1) = integral(f,a,r1)
         by A24,A25,A27,A28,INTEGRA6:17;

       Intf.r1 - G1 = integral(f,b,r1) - (G - integral(f,a,b)) by A13,A21; then
       Intf.r1 - G1 = integral(f,a,r1) - G by A29; then
       Intf.r1 - G1 = I.r1 - G by A22,A21,A11,A7,A8;
       hence thesis by A19,A20,A22,A21,A11,A7;
      end;
     end;
     hence f is_+infty_ext_Riemann_integrable_on b
       by A4,A12,A13,A14,LIMFUNC1:44,INTEGR10:def 5;
    end;
end;
