
theorem Th41:
for f be PartFunc of REAL,REAL, b,r be Real st
 left_closed_halfline b c= dom f & f is_-infty_improper_integrable_on b holds
   r(#)f is_-infty_improper_integrable_on b &
   improper_integral_-infty(r(#)f,b) = r * improper_integral_-infty(f,b)
proof
    let f be PartFunc of REAL,REAL, b,r be Real;
    assume that
A1:  left_closed_halfline b c= dom f and
A2:  f is_-infty_improper_integrable_on b;

A3: for d be Real st d <= b holds r(#)f is_integrable_on [' d,b ']
     & (r(#)f)|[' d,b '] is bounded
    proof
     let d be Real;
     assume
A4:   d <= b;
     [.d,b.] c= ].-infty,b.] by XXREAL_1:265; then
     [.d,b.] c= dom f by A1; then
A5:  ['d,b'] c= dom f by A4,INTEGRA5:def 3;
A6:  f is_integrable_on ['d,b'] & f|['d,b'] is bounded by A2,A4;
     hence r(#)f is_integrable_on ['d,b'] by A5,INTEGRA6:9;
     thus (r(#)f)|['d,b'] is bounded by A6,RFUNCT_1:80;
    end;

    per cases;
    suppose A7: f is_-infty_ext_Riemann_integrable_on b; then
A8:  improper_integral_-infty(f,b) = infty_ext_left_integral(f,b)
       by A2,Th22;
A9:  r(#)f is_-infty_ext_Riemann_integrable_on b &
     infty_ext_left_integral(r(#)f,b) = r*infty_ext_left_integral(f,b)
       by A1,A7,INTEGR10:11;
     thus r(#)f is_-infty_improper_integrable_on b
       by A1,A7,INTEGR10:11,Th20; then
     improper_integral_-infty(r(#)f,b) = infty_ext_left_integral(r(#)f,b)
       by A9,Th22;
     hence improper_integral_-infty(r(#)f,b)
       = r * improper_integral_-infty(f,b) by A8,A9,XXREAL_3:def 5;
    end;
    suppose A10: not f is_-infty_ext_Riemann_integrable_on b;
     consider Intf be PartFunc of REAL,REAL such that
A11:   dom Intf = left_closed_halfline b and
A12:   for x be Real st x in dom Intf holds Intf.x = integral(f,x,b)
        by A2;
A13:  dom(r(#)Intf) = left_closed_halfline b by A11,VALUED_1:def 5;

A14:  for x be Real st x in dom(r(#)Intf) holds
      (r(#)Intf).x = integral(r(#)f,x,b)
     proof
      let x be Real;
      assume A15: x in dom(r(#)Intf); then
A16:   (r(#)Intf).x = r*(Intf.x) by VALUED_1:def 5
       .= r*integral(f,x,b) by A15,A13,A12,A11;
A17:   x <= b by A13,A15,XXREAL_1:2;
      [.x,b.] c= ].-infty,b.] by XXREAL_1:265; then
      [.x,b.] c= dom f by A1; then
A18:   ['x,b'] c= dom f by A17,INTEGRA5:def 3;
      f is_integrable_on ['x,b'] & f|['x,b'] is bounded by A2,A17;
      hence (r(#)Intf).x = integral(r(#)f,x,b) by A16,A17,A18,INTEGRA6:10;
     end;

     per cases by A2,A10,Th22;
     suppose A19: improper_integral_-infty(f,b) = +infty; then
A20:   Intf is divergent_in-infty_to+infty by A2,A11,A12,Th37;

      per cases;
      suppose A21: r > 0; then
A22:    r(#)Intf is divergent_in-infty_to+infty
          by A19,A2,A11,A12,Th37,LIMFUNC1:59;
       thus r(#)f is_-infty_improper_integrable_on b
         by A3,A13,A14,A21,A20,LIMFUNC1:59; then
       improper_integral_-infty(r(#)f,b) = +infty by A13,A14,A22,Def3;
       hence improper_integral_-infty(r(#)f,b)
         = r * improper_integral_-infty(f,b) by A19,A21,XXREAL_3:def 5;
      end;
      suppose A23: r < 0; then
A24:    r(#)Intf is divergent_in-infty_to-infty
         by A19,A2,A11,A12,Th37,LIMFUNC1:59;
       thus r(#)f is_-infty_improper_integrable_on b
         by A3,A13,A14,A23,A20,LIMFUNC1:59; then
       improper_integral_-infty(r(#)f,b) = -infty by A13,A14,A24,Def3;
       hence improper_integral_-infty(r(#)f,b)
         = r * improper_integral_-infty(f,b) by A19,A23,XXREAL_3:def 5;
      end;
      suppose A25: r = 0;
A26:    for R be Real
        ex g be Real st g < R & g in dom(r(#)Intf)
         by A11,A13,A20,LIMFUNC1:48;
A27:    for g1 be Real st 0 < g1
        ex R be Real st for r1 be Real st r1 < R
         & r1 in dom(r(#)Intf) holds |. (r(#)Intf).r1 - 0 .| < g1
       proof
        let g1 be Real;
        assume A28: 0 < g1;
        now let r1 be Real;
         assume r1 < b & r1 in dom(r(#)Intf); then
         (r(#)Intf).r1 = r * Intf.r1 by VALUED_1:def 5 .= 0 by A25;
         hence |. (r(#)Intf).r1 - 0 .| < g1 by A28,ABSVALUE:2;
        end;
        hence thesis;
       end; then
A29:    r(#)Intf is convergent_in-infty by A26,LIMFUNC1:45; then
A30:    lim_in-infty (r(#)Intf) = 0 by A27,LIMFUNC1:78;
       thus r(#)f is_-infty_improper_integrable_on b
          by A3,A13,A14,A27,A26,LIMFUNC1:45; then
       improper_integral_-infty(r(#)f,b) = 0 by A13,A14,A29,A30,Def3;
       hence improper_integral_-infty(r(#)f,b)
         = r * improper_integral_-infty(f,b) by A25;
      end;
     end;
     suppose A31: improper_integral_-infty(f,b) = -infty; then
A32:   Intf is divergent_in-infty_to-infty by A2,A11,A12,Th38;
      per cases;
      suppose A33: r > 0; then
A34:    r(#)Intf is divergent_in-infty_to-infty
         by A31,A2,A11,A12,Th38,LIMFUNC1:59;
       thus r(#)f is_-infty_improper_integrable_on b
         by A3,A13,A14,A33,A32,LIMFUNC1:59; then
       improper_integral_-infty(r(#)f,b) = -infty by A13,A14,A34,Def3;
       hence improper_integral_-infty(r(#)f,b)
         = r * improper_integral_-infty(f,b) by A31,A33,XXREAL_3:def 5;
      end;
      suppose A35: r < 0; then
A36:    r(#)Intf is divergent_in-infty_to+infty
         by A31,A2,A11,A12,Th38,LIMFUNC1:59;
       thus r(#)f is_-infty_improper_integrable_on b
         by A3,A13,A14,A35,A32,LIMFUNC1:59; then
       improper_integral_-infty(r(#)f,b) = +infty by A13,A14,A36,Def3;
       hence improper_integral_-infty(r(#)f,b)
         = r * improper_integral_-infty(f,b) by A31,A35,XXREAL_3:def 5;
      end;
      suppose A37: r = 0;
A38:    for R be Real
        ex g be Real st g < R & g in dom(r(#)Intf)
          by A11,A13,A32,LIMFUNC1:49;
A39:    for g1 be Real st 0 < g1
        ex R be Real st for r1 be Real st r1 < R
         & r1 in dom(r(#)Intf) holds |. (r(#)Intf).r1 - 0 .| < g1
       proof
        let g1 be Real;
        assume A40: 0 < g1;
        now let r1 be Real;
         assume r1 < b & r1 in dom(r(#)Intf); then
         (r(#)Intf).r1 = r * Intf.r1 by VALUED_1:def 5 .= 0 by A37;
         hence |. (r(#)Intf).r1 - 0 .| < g1 by A40,ABSVALUE:2;
        end;
        hence thesis;
       end; then
A41:    r(#)Intf is convergent_in-infty by A38,LIMFUNC1:45; then
A42:    lim_in-infty (r(#)Intf) = 0 by A39,LIMFUNC1:78;
       thus r(#)f is_-infty_improper_integrable_on b
         by A3,A13,A14,A39,A38,LIMFUNC1:45; then
       improper_integral_-infty(r(#)f,b) = 0 by A13,A14,A41,A42,Def3;
       hence improper_integral_-infty(r(#)f,b)
         = r * improper_integral_-infty(f,b) by A37;
      end;
     end;
    end;
end;
