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

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

A4:  for c be Real st c <= b holds
       f is_integrable_on ['c,b'] & f|['c,b'] is bounded
     proof
      let c be Real;
      assume A5: c <= b; then
      c <= a by A3,XXREAL_0:2; then
A6:   f is_integrable_on ['c,a'] & f|['c,a'] is bounded by A2,INTEGR10:def 6;
      ['c,a'] = [.c,a.] by A5,A3,XXREAL_0:2,INTEGRA5:def 3; then
      ['c,a'] c= ].-infty,a.] by XXREAL_1:265; then
      ['c,a'] 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 = left_closed_halfline(a) and
A8:   for x be Real st x in dom I holds I.x = integral(f,x,a) and
A9:  I is convergent_in-infty by A2,INTEGR10:def 6;

     -infty < b by XREAL_0:def 1,XXREAL_0:12; then
     reconsider B = ].-infty,b.] as non empty Subset of REAL by XXREAL_1:2;

     deffunc F(Element of B) = In(integral(f,$1,b),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 = left_closed_halfline(b) by FUNCT_2:def 1;
A13:  for x be Real st x in dom Intf holds Intf.x = integral(f,x,b)
     proof
      let x be Real;
      assume x in dom Intf; then
      Intf.x = In(integral(f,x,b),REAL) by A10,A11;
      hence Intf.x = integral(f,x,b);
     end;

A14:  for r be Real ex g be Real st g<r & g in dom Intf
     proof
      let r be Real;
      consider g be Real such that
A15:    g < min(b,r) by XREAL_1:2;
A16:   -infty < g by XREAL_0:def 1,XXREAL_0:12;
      r >= min(b,r) & b >= min(b,r) by XXREAL_0:17; then
A17:   g < r & g < b by A15,XXREAL_0:2; then
      g in ].-infty,b.] by A16,XXREAL_1:2;
      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 r1<r & r1 in dom I holds |. I.r1-G .| < g1
          by A9,LIMFUNC1:45;

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

     for g1 be Real st 0<g1
      ex r be Real st
       for r1 be Real st r1<r & 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 r1 < R & r1 in dom I holds |. I.r1-G .| < g1
         by A18;
      take R;
      thus for r1 be Real st r1<R & r1 in dom Intf holds
       |. Intf.r1 - G1 .| < g1
      proof
       let r1 be Real;
       assume that
A20:     r1 < R and
A21:     r1 in dom Intf;

A22:   ].-infty,b.] c= ].-infty,a.] by A3,XXREAL_1:42;

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

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

       Intf.r1 - G1 = integral(f,r1,b) - (G - integral(f,b,a)) by A13,A21; then
       Intf.r1 - G1 = integral(f,r1,a) - 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,INTEGR10:def 6,LIMFUNC1:45;
    end;
end;
