INTEGR24

index · ← MESFUN14 · HILB10_6 →
:: Improper Integral, Part {I}
::  by Noboru Endou
:: 
:: Received September 30, 2021
:: Copyright (c) 2021-2026 Association of Mizar Users
::           (Stowarzyszenie Uzytkownikow Mizara, Bialystok, Poland).
:: This code can be distributed under the GNU General Public Licence
:: version 3.0 or later, or the Creative Commons Attribution-ShareAlike
:: License version 3.0 or later, subject to the binding interpretation
:: detailed in file COPYING.interpretation.
:: See COPYING.GPL and COPYING.CC-BY-SA for the full text of these
:: licenses, or see http://www.gnu.org/licenses/gpl.html and
:: http://creativecommons.org/licenses/by-sa/3.0/.

environ

 vocabularies FUNCT_1, NUMBERS, SUBSET_1, ARYTM_3, CARD_1, RELAT_1, TARSKI,
      ORDINAL2, XXREAL_0, NAT_1, XXREAL_2, XBOOLE_0, REAL_1, MEASURE7,
      XXREAL_1, ARYTM_1, CARD_3, FINSEQ_1, ORDINAL4, SEQ_2, COMPLEX1, SEQ_1,
      PARTFUN1, INTEGRA1, INTEGRA2, INTEGRA4, INTEGRA5, REALSET1, SEQ_4,
      FUNCT_3, VALUED_1, FUNCT_2, LIMFUNC1, LIMFUNC2, INTEGR10, FUNCT_7,
      RFINSEQ, INTEGR24;
 notations TARSKI, XBOOLE_0, SUBSET_1, SEQ_1, FUNCT_1, RELSET_1, PARTFUN1,
      ORDINAL1, XXREAL_3, VALUED_1, FINSEQ_1, RVSUM_1, SEQ_2, SEQ_4, FUNCT_2,
      XXREAL_2, XXREAL_0, XCMPLX_0, COMPLEX1, XREAL_0, NUMBERS, NAT_1,
      VALUED_0, RCOMP_1, INTEGRA1, INTEGRA2, RFUNCT_1, INTEGRA3, INTEGRA4,
      INTEGRA5, RFINSEQ, LIMFUNC1, LIMFUNC2, INTEGR10;
 constructors PROB_3, RVSUM_1, RFUNCT_1, SEQ_2, SEQ_4, NEWTON, COMSEQ_2,
      INTEGRA2, INTEGRA4, INTEGRA5, INTEGRA3, LIMFUNC1, LIMFUNC2, RFINSEQ,
      REAL_1, RELSET_1, INTEGR10;
 registrations XBOOLE_0, ORDINAL1, NUMBERS, XREAL_0, MEMBERED, VALUED_0,
      XXREAL_2, RELSET_1, NAT_1, FINSEQ_1, RELAT_1, FINSET_1, XXREAL_0, CARD_1,
      INTEGRA1, SEQM_3, FUNCT_2, XXREAL_3, SEQ_4, VALUED_1;
 requirements NUMERALS, BOOLE, SUBSET, REAL, ARITHM;
 equalities XCMPLX_0, LIMFUNC1, PROB_1, VALUED_1;
 expansions MEMBERED;
 theorems TARSKI, FUNCT_1, FUNCT_2, NAT_1, XBOOLE_0, XBOOLE_1, XXREAL_0,
      ORDINAL1, XXREAL_2, XXREAL_3, XXREAL_1, XREAL_1, VALUED_0, FINSEQ_1,
      PARTFUN1, FINSEQ_3, RVSUM_1, RELAT_1, FINSEQ_2, INTEGRA5, INTEGRA1,
      INTEGRA4, RFUNCT_1, SEQ_4, VALUED_1, SEQ_2, ABSVALUE, INTEGRA3, SEQ_1,
      RELSET_1, INTEGRA2, LIMFUNC2, INTEGR10, RCOMP_1, COMPLEX1, INTEGRA6,
      LIMFUNC1, RFINSEQ, FINSEQ_5, SEQM_3, RFUNCT_2;
 schemes FUNCT_2;

begin :: Preliminaries

Lm1:
for f be PartFunc of REAL,REAL, a,b,c be Real
 st a < b < c & ['a,c'] c= dom f & f|['a,b'] is bounded &
 f|['b,c'] is bounded &
 f is_integrable_on ['a,b'] & f is_integrable_on ['b,c']
 holds f is_integrable_on ['a,c']
proof
    let f be PartFunc of REAL,REAL, a,b,c be Real;
    assume that
A1:  a < b < c and
A2:  ['a,c'] c= dom f and
A3:  f|['a,b'] is bounded and
A4:  f|['b,c'] is bounded and
A5:  f is_integrable_on ['a,b'] and
A6:  f is_integrable_on ['b,c'];

    set AB = ['a,b'], BC = ['b,c'], AC = ['a,c'];
    set F1 = f||['a,b'];
    set F2 = f||['b,c'];
A7: (f||AC)|AC = f|AC;

    dom(f|AC) = AC by A2,RELAT_1:62; then
A8: f||AC is Function of AC,REAL by FUNCT_2:def 1;

A9: AB = [.a,b.] & BC = [.b,c.] & AC = [.a,c.]
      by A1,INTEGRA5:def 3,XXREAL_0:2; then
A10:AB \/ BC = AC by A1,XXREAL_1:165; then
    f|AC is bounded by A3,A4,RFUNCT_1:87; then
A11: f||AC is upper_integrable lower_integrable by A7,A8,INTEGRA4:10;

A12: BC c= AC & AB c= AC by A1,A9,XXREAL_1:34; then
    BC c= dom f & AB c= dom f by A2; then
    dom(f|BC) = BC & dom(f|AB) = AB by RELAT_1:62; then
A13: f||BC is Function of BC,REAL
  & f||AB is Function of AB,REAL by FUNCT_2:def 1;

    [.b,c.] = [.lower_bound([.b,c.]), upper_bound([.b,c.]).]
  & [.a,b.] = [.lower_bound([.a,b.]), upper_bound([.a,b.]).]
  & [.a,c.] = [.lower_bound([.a,c.]), upper_bound([.a,c.]).]
       by A9,INTEGRA1:4; then
A14:upper_bound BC = c & lower_bound BC = b
  & upper_bound AB = b & lower_bound AB = a
  & upper_bound AC = c & lower_bound AC = a by A9,INTEGRA1:5;

    vol BC = upper_bound BC - lower_bound BC by INTEGRA1:def 5; then
    consider PS2 being DivSequence of BC such that
A15: delta PS2 is convergent & lim delta PS2 =0 and
A16: for n be Element of NAT holds ex Tn being Division of BC
       st Tn divide_into_equal n+1 & PS2.n =Tn
         by A1,A14,XREAL_1:50,INTEGRA6:16;

A17:for i be Element of NAT st 2 <= i
      ex S2i be Division of BC st S2i=PS2.i & 2 <= len S2i
    proof
     let i be Element of NAT;
     assume
A18:  2 <= i;
     consider Tn being Division of BC such that
A19:  Tn divide_into_equal i+1 and
A20:  PS2.i =Tn by A16;
     reconsider Tn as Division of BC;
     take Tn;
     thus Tn=PS2.i by A20;
     len Tn = i+1 by A19,INTEGRA4:def 1;
     then i <= len Tn by NAT_1:11;
     hence 2 <= len Tn by A18,XXREAL_0:2;
    end;

    defpred Q[set,set] means
     ex n being Element of NAT, e being Division of BC
      st n = $1 & e = $2 & e = PS2.(n+2);
A21:for n be Element of NAT ex D being Element of divs BC st Q[n,D]
    proof
     let n be Element of NAT;
     reconsider D = PS2.(n+2) as Element of divs BC by INTEGRA1:def 3;
     take D;
     thus thesis;
    end;

    consider S2 being sequence of divs BC such that
A22: for n be Element of NAT holds Q[n,S2.n] from FUNCT_2:sch 3(A21);
    reconsider S2 as DivSequence of BC;

    defpred P1[Element of NAT, set] means
     ex S be Division of BC st S = S2.$1 & $2 = S/^1;

A23:now let i be Element of NAT;
     ex n being Element of NAT,e being Division of BC
      st n = i & e = S2.i & e = PS2.(n+2) by A22;
     hence ex S2i be Division of BC st S2i=S2.i & 2 <= len S2i
       by A17,NAT_1:11;
    end;

A24:for i be Element of NAT ex T be Element of divs BC st P1[i,T]
    proof
     let i be Element of NAT;
     consider S be Division of BC such that
A25:  S=S2.i and
A26:  2 <= len S by A23;
     set T=S/^1;
A27: 1 <= len S by A26,XXREAL_0:2;
     2-1 <= len S -1 by A26,XREAL_1:13; then
A28: 1 <= len T by A27,RFINSEQ:def 1;
     then len T in dom T by FINSEQ_3:25;
     then T.(len T) =S.(len T+ 1) by A27,RFINSEQ:def 1;
     then T.(len T) =S.(len S -1+ 1) by A27,RFINSEQ:def 1;
     then
A29: T.(len T) = upper_bound BC by INTEGRA1:def 2;
     rng S c= BC & rng T c= rng S by FINSEQ_5:33,INTEGRA1:def 2;
     then
A30: rng T c= BC;
     T is non empty increasing by A26,A28,INTEGRA1:34,XXREAL_0:2;
     then T is Division of BC by A30,A29,INTEGRA1:def 2;
     then T is Element of divs BC by INTEGRA1:def 3;
     hence thesis by A25;
    end;

    consider T2 be DivSequence of BC such that
A31: for i be Element of NAT holds P1[i,T2.i] from FUNCT_2:sch 3(A24);

A32:for n be Element of NAT holds ex D be Division of BC st D = T2.n
  & for i be Element of NAT st i in dom D holds b < D.i
    proof
     let n be Element of NAT;
     reconsider D=T2.n as Division of BC;
     take D;
     consider E be Division of BC such that
A33:  E=S2.n and
A34:  T2.n=E/^1 by A31;
A35: ex E1 be Division of BC st E1=S2.n & 2 <= len E1 by A23;
     then
A36: 2-1 <= len E -1 by A33,XREAL_1:13;
A37: 1 <= len E by A33,A35,XXREAL_0:2;
     then 1 in Seg len E by FINSEQ_1:1;
     then
A38: 1 in dom E by FINSEQ_1:def 3;
     then rng E c= BC & E.1 in rng E by FUNCT_1:def 3,INTEGRA1:def 2;
     then
A39: b <= E.1 by A9,XXREAL_1:1;
     2 in Seg len E by A33,A35,FINSEQ_1:1;
     then 2 in dom E by FINSEQ_1:def 3;
     then
A40: E.1 < E.2 by A38,SEQM_3:def 1;
     len D = len E -1 by A34,A37,RFINSEQ:def 1;
     then 1 in Seg len D by A36,FINSEQ_1:1;
     then
A41: 1 in dom D by FINSEQ_1:def 3;
     then
A42: D.1 = E.(1+1) by A34,A37,RFINSEQ:def 1;
     then
A43: b < D.1 by A39,A40,XXREAL_0:2;
     now
      let i be Element of NAT;
      assume
A44:  i in dom D;
      then
A45:  1 <=i by FINSEQ_3:25;
      thus now
       assume i <> 1;
       then 1 < i by A45,XXREAL_0:1;
       then D.1 < D.i by A41,A44,SEQM_3:def 1;
       hence b < D.i by A43,XXREAL_0:2;
      end;
      hence b < D.i by A42,A39,A40,XXREAL_0:2;
     end;
     hence thesis;
    end;

    consider T1 be DivSequence of AB such that
A46: delta T1 is convergent & lim delta T1 = 0 by INTEGRA4:11;
A47:for n be Element of NAT holds
     ex D be Division of BC st D = T2.n & 1 <= len D
    proof
     let n be Element of NAT;
     reconsider D=T2.n as Division of BC;
     take D;
     consider E be Division of BC such that
A48:  E=S2.n and
A49:  T2.n=E/^1 by A31;
     ex E1 be Division of BC st E1=S2.n & 2 <= len E1 by A23;
     then 1 <= len E & 2-1 <= len E -1 by A48,XREAL_1:13,XXREAL_0:2;
     hence thesis by A49,RFINSEQ:def 1;
    end;

    defpred P2[Element of NAT,set] means
     ex S1 be Division of AB, S2 be Division of BC
      st S1=T1.$1 & S2=T2.$1 & $2=S1^S2;

A50:for i be Element of NAT ex T be Element of divs AC st P2[i,T]
    proof
     let i0 be Element of NAT;
     reconsider S1=T1.i0 as Division of AB;
     reconsider S2=T2.i0 as Division of BC;
     set T=S1^S2;
     ex D be Division of BC st D = T2.i0 & 1 <= len D by A47;
     then len S2 in Seg len S2 by FINSEQ_1:1;
     then
A51: len S2 in dom S2 by FINSEQ_1:def 3;
A52: rng S1 c= AB by INTEGRA1:def 2;
     now
      let i,j be Nat;
      assume that
A53:  i in dom T and
A54:  j in dom T and
A55:  i < j;
A56:  1 <= i by A53,FINSEQ_3:25;
A57:  j <= len T by A54,FINSEQ_3:25;
A58:  i <= len T by A53,FINSEQ_3:25;
A59:  now
       j <= len S1 + len S2 by A57,FINSEQ_1:22;
       then
A60:   j-len S1 <= len S2 by XREAL_1:20;
       assume
A61:   j > len S1;
       then
A62:   T.j = S2.(j-len S1) by A57,FINSEQ_1:24;
A63:   len S1 + 1 <=j by A61,NAT_1:13;
       then consider m be Nat such that
A64:   (len S1 + 1)+m=j by NAT_1:10;
       reconsider m as Element of NAT by ORDINAL1:def 12;
       1+m = j - len S1 by A64;
       then 1 <= 1+m by A63,XREAL_1:19;
       then 1+m in Seg len S2 by A64,A60,FINSEQ_1:1;
       then
A65:   j - len S1 in dom S2 by A64,FINSEQ_1:def 3;
A66:   now
        i <= len S1 + len S2 by A58,FINSEQ_1:22;
        then
A67:    i-len S1 <= len S2 by XREAL_1:20;
A68:    i - len S1 < j -len S1 by A55,XREAL_1:14;
        assume
A69:     i > len S1;
        then
A70:    len S1 + 1 <=i by NAT_1:13;
        then consider m be Nat such that
A71:    (len S1 + 1)+m=i by NAT_1:10;
        reconsider m as Element of NAT by ORDINAL1:def 12;
        1+m = i - len S1 by A71;
        then 1 <= 1+m by A70,XREAL_1:19;
        then 1+m in Seg len S2 by A71,A67,FINSEQ_1:1;
        then
A72:    i - len S1 in dom S2 by A71,FINSEQ_1:def 3;
        T.i = S2.(i-len S1) by A58,A69,FINSEQ_1:24;
        hence T.i < T.j by A62,A65,A68,A72,SEQM_3:def 1;
       end;
       now
        assume i <= len S1;
        then
A73:    i in dom S1 by A56,FINSEQ_3:25;
        then T.i = S1.i by FINSEQ_1:def 7;
        then T.i in rng S1 by A73,FUNCT_1:def 3;
        then
A74:    T.i <= b by A9,A52,XXREAL_1:1;
        ex DD be Division of ['b,c'] st DD = T2.i0 & for k be
          Element of NAT st k in dom DD holds b < DD.k by A32;
        hence T.i < T.j by A62,A65,A74,XXREAL_0:2;
       end;
       hence T.i < T.j by A66;
      end;
A75:  1 <= j by A54,FINSEQ_3:25;
      now
       assume
A76:    j <= len S1;
       then
A77:   j in dom S1 by A75,FINSEQ_3:25;
       then
A78:   T.j = S1.j by FINSEQ_1:def 7;
       i <= len S1 by A55,A76,XXREAL_0:2;
       then
A79:   i in dom S1 by A56,FINSEQ_3:25;
       then T.i = S1.i by FINSEQ_1:def 7;
       hence T.i < T.j by A55,A79,A77,A78,SEQM_3:def 1;
      end;
      hence T.i < T.j by A59;
     end;
     then
A80: T is non empty increasing FinSequence of REAL by SEQM_3:def 1;
     rng S2 c= ['b,c'] by INTEGRA1:def 2;
     then rng S1 \/ rng S2 c= AB \/ BC by A52,XBOOLE_1:13;
     then rng S1 \/ rng S2 c= AC by A1,A9,XXREAL_1:174;
     then
A81: rng T c= AC by FINSEQ_1:31;
     T.(len T) = T.(len S1 + len S2) by FINSEQ_1:22
      .= S2.(len S2) by A51,FINSEQ_1:def 7
      .= upper_bound AC by A14,INTEGRA1:def 2;
     then T is Division of AC by A81,A80,INTEGRA1:def 2;
     then T is Element of divs AC by INTEGRA1:def 3;
     hence thesis;
    end;

    consider T be DivSequence of AC such that
A82: for i be Element of NAT holds P2[i,T.i] from FUNCT_2:sch 3(A50);

A83:for i, k be Element of NAT, S0 be Division of AB st
     S0=T1.i & k in Seg len S0 holds divset(T.i,k) = divset(T1.i,k)
    proof
     let i,k be Element of NAT, S0 be Division of AB;
     assume
A84:  S0=T1.i;
     reconsider S=T.i as Division of AC;
A85: divset(T1.i,k) =
 [. lower_bound divset(T1.i,k),upper_bound divset(T1.i,k).] by INTEGRA1:4;
     consider S1 be Division of AB, S2 be Division of BC such that
A86:  S1=T1.i and
      S2=T2.i and
A87:  T.i=S1^S2 by A82;
     assume
A88: k in Seg len S0;
     then
A89:k in dom S1 by A84,A86,FINSEQ_1:def 3;
     len S = len S1 + len S2 by A87,FINSEQ_1:22;
     then Seg len S1 c= Seg len S by NAT_1:11,FINSEQ_1:5;
     then k in Seg len S by A84,A88,A86;
     then
A90:k in dom S by FINSEQ_1:def 3;
A91:divset(T.i,k) =
[.lower_bound divset(T.i,k),upper_bound divset(T.i,k).] by INTEGRA1:4;
A92:now
      k <= len S1 & k-1 <= k -0 by A84,A88,A86,FINSEQ_1:1,XREAL_1:10;
      then
A93: k-1 <= len S1 by XXREAL_0:2;
      assume
A94:  k <> 1;
      1 <=k by A88,FINSEQ_1:1;
      then
A95: 1 < k by A94,XXREAL_0:1;
      then 1+1 <= k by NAT_1:13;
      then
A96: 2-1 <= k-1 by XREAL_1:9;
      k-1 is Element of NAT by A95,NAT_1:20;
      then k-1 in Seg len S1 by A93,A96,FINSEQ_1:1;
      then
A97: k-1 in dom S1 by FINSEQ_1:def 3;
      thus divset(T.i,k) =[. S.(k-1),upper_bound divset(T.i,k) .]
      by A90,A91,A94,INTEGRA1:def 4
        .=[. S.(k-1),S.k .] by A90,A94,INTEGRA1:def 4
        .=[. S.(k-1),S1.k .] by A87,A89,FINSEQ_1:def 7
        .=[. S1.(k-1),S1.k .] by A87,A97,FINSEQ_1:def 7
        .=[. lower_bound divset(T1.i,k),S1.k .] by A86,A89,A94,INTEGRA1:def 4
        .= divset(T1.i,k) by A86,A89,A85,A94,INTEGRA1:def 4;
     end;
     now
      assume
A98: k=1;
      hence divset(T.i,k) =[. lower_bound AC,upper_bound divset(T.i,k) .]
       by A90,A91,INTEGRA1:def 4
        .=[. lower_bound AC,S.k .] by A90,A98,INTEGRA1:def 4
        .=[. lower_bound AC,S1.k .] by A87,A89,FINSEQ_1:def 7
        .=[. lower_bound divset(T1.i,k),S1.1 .]
        by A14,A86,A89,A98,INTEGRA1:def 4
        .= divset(T1.i,k) by A86,A89,A85,A98,INTEGRA1:def 4;
     end;
     hence thesis by A92;
    end;

A99: for i, k be Element of NAT, S01 be Division of AB, S02 be
Division of BC st S01=T1.i & S02=T2.i & k in Seg len S02 holds divset(T.
  i,(len S01 + k)) = divset(T2.i,k)
  proof
    let i,k be Element of NAT, S01 be Division of AB, S02 be Division
    of BC;
    assume that
A100: S01=T1.i and
A101: S02=T2.i;
    reconsider S=T.i as Division of AC;
    consider S1 be Division of AB, S2 be Division of BC such that
A102: S1=T1.i and
A103: S2=T2.i and
A104: T.i = S1^S2 by A82;
    assume
A105: k in Seg len S02;
    then
A106: k in dom S2 by A101,A103,FINSEQ_1:def 3;
    then
A107: len S1 + k in dom S by A104,FINSEQ_1:28;
A108: divset(T2.i,k) =
[. lower_bound divset(T2.i,k), upper_bound divset(T2.i,k).] by INTEGRA1:4;
A109: divset(T.i,(len S1 + k)) =
[.lower_bound divset(T.i,(len S1 + k)), upper_bound divset
    (T .i,(len S1 + k)).] by INTEGRA1:4;
A110: now
      k <= len S2 & k-1 <= k -0 by A101,A105,A103,FINSEQ_1:1,XREAL_1:10;
      then
A111: k-1 <= len S2 by XXREAL_0:2;
      assume
A112: k <> 1;
A113: 1 <=k by A105,FINSEQ_1:1;
      then
A114: 1 < k by A112,XXREAL_0:1;
      then 1+1 <= k by NAT_1:13;
      then
A115: 2-1 <= k-1 by XREAL_1:9;
      k-1 is Element of NAT by A114,NAT_1:20;
      then k-1 in Seg len S2 by A111,A115,FINSEQ_1:1;
      then
A116: k-1 in dom S2 by FINSEQ_1:def 3;
A117: 1+0 < k + len S1 by A113,XREAL_1:8;
      hence divset(T.i,(len S1 + k)) =
      [. S.(len S1 + k-1),upper_bound divset(T.i,len S1
      + k) .] by A107,A109,INTEGRA1:def 4
        .=[. S.(len S1 + k-1),S.(len S1 + k) .] by A107,A117,INTEGRA1:def 4
        .=[. S.(len S1 + (k-1)),S2.k .] by A104,A106,FINSEQ_1:def 7
        .=[. S2.(k-1),S2.k .] by A104,A116,FINSEQ_1:def 7
        .=[. lower_bound divset(T2.i,k), S2.k .]
        by A103,A106,A112,INTEGRA1:def 4
        .= divset(T2.i,k) by A103,A106,A108,A112,INTEGRA1:def 4;
    end;
    now
      len S1 in Seg len S1 by FINSEQ_1:3;
      then
A118: len S1 in dom S1 by FINSEQ_1:def 3;
      assume
A119: k=1;
      len S1 <> 0;
      then
A120: len S1 + k <> 1 by A119;
      hence divset(T.i,(len S1 + k)) =
      [. S.(len S1 + k-1),upper_bound divset(T.i,len S1 + k) .]
        by A107,A109,INTEGRA1:def 4
        .=[. S1.(len S1),upper_bound divset(T.i,len S1 +k) .]
        by A104,A119,A118,FINSEQ_1:def 7
        .=[. upper_bound AB, upper_bound divset(T.i,len S1 + k) .]
        by INTEGRA1:def 2
        .=[. lower_bound BC, S.(len S1 + k) .] by A14,A107,A120,
                        INTEGRA1:def 4
        .=[. lower_bound BC, S2.k .] by A104,A106,FINSEQ_1:def 7
        .=[. lower_bound divset(T2.i,k), S2.1 .]
        by A103,A106,A119,INTEGRA1:def 4
        .= divset(T2.i,k) by A103,A106,A108,A119,INTEGRA1:def 4;
    end;
    hence thesis by A100,A102,A110;
  end;

A121: for i, k be Element of NAT, S0 be Division of BC st S0=T2.i & k
  in Seg len S0 holds divset(T2.i,k) c= BC
  proof
    let i,k be Element of NAT, S0 be Division of BC;
    assume that
A122: S0=T2.i and
A123: k in Seg len S0;
    k in dom S0 by A123,FINSEQ_1:def 3;
    hence thesis by A122,INTEGRA1:8;
  end;

A124: for i,k be Element of NAT, S0 be Division of AB st S0=T1.i & k
  in Seg len S0 holds divset(T1.i,k) c= AB
  proof
    let i,k be Element of NAT, S0 be Division of AB;
    assume that
A125: S0=T1.i and
A126: k in Seg (len S0);
    k in dom S0 by A126,FINSEQ_1:def 3;
    hence thesis by A125,INTEGRA1:8;
  end;

A127: for i be Element of NAT holds
   upper_volume(f||AC,T.i)
     = (upper_volume(f||AB,T1.i))^(upper_volume(f||BC,T2.i))
  proof
    let i be Element of NAT;
    reconsider F = upper_volume(f||AC,T.i) as FinSequence of REAL;
    reconsider F1 = upper_volume(f||AB,T1.i) as FinSequence of REAL;
    reconsider F2 = upper_volume(f||BC,T2.i) as FinSequence of REAL;
    reconsider S=T.i as Division of AC;
    consider S1 be Division of AB, S2 be Division of BC such
    that
A128: S1=T1.i and
A129: S2=T2.i and
A130: T.i =S1^S2 by A82;
A131: len F = len S by INTEGRA1:def 6
      .= len S1+ len S2 by A130,FINSEQ_1:22
      .= len F1 + len S2 by A128,INTEGRA1:def 6
      .= len F1 + len F2 by A129,INTEGRA1:def 6;
A132: now
      let k be Nat;
      assume
A133: k in dom F2;
      then
A134: k in Seg len F2 by FINSEQ_1:def 3;
      then 1 <=k by FINSEQ_1:1;
      then
A135: 1 + len F1 <= k + len F1 by XREAL_1:6;
A136:k <= len F2 by A134,FINSEQ_1:1;

      1 <= 1+ len F1 by NAT_1:11;
      then 1 <= k + len F1 by A135,XXREAL_0:2;
      then k+ len F1 in Seg len F by A136,A131,XREAL_1:6,FINSEQ_1:1;
      then len F1 + k in Seg len S by INTEGRA1:def 6;
      then len F1 + k in dom S by FINSEQ_1:def 3;
      then
A137: F.(len F1 + k) =(upper_bound rng((f||AC)|divset(T.i,(len F1 + k)))) * vol
      divset(T.i,len F1 + k) by INTEGRA1:def 6;
      k in Seg len F2 by A133,FINSEQ_1:def 3;
      then
A138: k in Seg len S2 by A129,INTEGRA1:def 6;
      then
A139: k in dom S2 by FINSEQ_1:def 3;
      len F1= len S1 by A128,INTEGRA1:def 6;
      then
A140: divset(T.i,len F1 + k) = divset(T2.i,k) by A99,A128,A129,A138;
      then
A141: divset(T.i,len F1 + k) c= [' b,c '] by A121,A129,A138;
      then divset(T.i,len F1 + k) c= [' a,c '] by A12;
      then F.(len F1 + k)=
      (upper_bound rng((f||BC)|divset(T2.i,k))) * vol divset(T2.i,k)
      by A137,A140,A141,INTEGRA6:3;
      hence F.(len F1 + k) =F2.k by A129,A139,INTEGRA1:def 6;
    end;
A142: now
      let k be Nat;
      assume k in dom F1;
      then
A143: k in Seg len F1 by FINSEQ_1:def 3;
      then
A144: k in Seg len S1 by A128,INTEGRA1:def 6;
      then
A145: k in dom S1 by FINSEQ_1:def 3;
      Seg len F1 c= Seg len F by A131,NAT_1:11,FINSEQ_1:5;
      then k in Seg len F by A143;
      then k in Seg len S by INTEGRA1:def 6;
      then k in dom S by FINSEQ_1:def 3;
      then
A146: F.k = (upper_bound rng((f||AC)|divset(T.i,k)))*vol divset(T.i,k) by
INTEGRA1:def 6;
A147: divset(T.i,k) = divset(T1.i,k) by A83,A128,A144;
      then
A148: divset(T.i,k) c= AB by A124,A128,A144;
      then divset(T.i,k) c= AC by A12;
      then F.k =
       (upper_bound rng((f||AB)|divset(T1.i,k))) * vol divset(T1.i,k)
         by A146,A147,A148,INTEGRA6:3;
      hence F.k = F1.k by A128,A145,INTEGRA1:def 6;
    end;
    dom F = Seg (len F1 + len F2) by A131,FINSEQ_1:def 3;
    hence thesis by A142,A132,FINSEQ_1:def 7;
  end;

A149: for i be Element of NAT holds Sum upper_volume(f||AC,T.i) = Sum
  upper_volume(f||AB,T1.i) + Sum upper_volume(f||BC,T2.i)
  proof
    let i be Element of NAT;
    upper_volume(f||AC,T.i) = (upper_volume(f||AB,T1.i))^(upper_volume(f||BC,
    T2.i) ) by A127;
    hence thesis by RVSUM_1:75;
  end;

  now
    let i be Nat;
     reconsider ii=i as Element of NAT by ORDINAL1:def 12;
    thus upper_sum(f||AC,T).i =upper_sum(f||AC,T.ii) by INTEGRA2:def 2
      .= Sum upper_volume(f||AC,T.ii) by INTEGRA1:def 8
      .= Sum upper_volume(f||AB,T1.i) + Sum upper_volume(f||BC,T2.i)
        by A149
      .=upper_sum(f||AB,T1.ii) +Sum(upper_volume(f||BC,T2.ii))
        by INTEGRA1:def 8
      .=upper_sum(f||AB,T1.ii) + upper_sum(f||BC,T2.ii)
        by INTEGRA1:def 8
      .=upper_sum(f||AB,T1).i + upper_sum(f||BC,T2.ii) by INTEGRA2:def 2
      .=upper_sum(f||AB,T1).i +upper_sum(f||BC,T2).i by INTEGRA2:def 2;
  end;
  then
A150: upper_sum(f||AC,T) = upper_sum(f||AB,T1) +upper_sum(f||BC,T2) by SEQ_1:7;
A151: now
    let e be Real;
    assume 0 < e;
    then consider m be Nat such that
A152: for n be Nat st m <= n holds |.delta(PS2).n -0 .| < e
    by A15,SEQ_2:def 7;
    take m;
    hereby
      let n be Nat;
A153: n <=n+2 by NAT_1:11;
      assume m <=n;
      then m <=n+2 by A153,XXREAL_0:2;
      then |.delta(PS2).(n+2) -0 .| < e by A152;
      then
A154: |.delta(PS2.(n+2)) -0 .| < e by INTEGRA3:def 2;
      n in NAT by ORDINAL1:def 12;
      then ex k being Element of NAT, e1 being Division of ['b,c'] st k = n
      & e1 =S2.n & e1 = PS2.(k+2) by A22;
      hence |.delta(S2).n -0 .| < e by A154,INTEGRA3:def 2;
    end;
  end;

  set XBC = chi(BC,BC);

A155: now
    let e be Real;
    assume
A156: e > 0;
    then consider m be Nat such that
A157: for n be Nat st m <=n holds |. delta(S2).n - 0 .| < e/2
      by A151,XREAL_1:215;
    take m;
A158: e/2 < e by A156,XREAL_1:216;
      let nn be Nat;
      assume
A159:     m <=nn;
       reconsider n=nn as Element of NAT by ORDINAL1:def 12;
      |. delta(S2).n - 0 .| < e/2 by A157,A159;
      then 0 <= delta(S2.n) & |.delta(S2.n).| < e/2 by INTEGRA3:9,def 2;
      then
      delta(S2.n) < e/2 by ABSVALUE:def 1; then
A160: max rng upper_volume(XBC,S2.n) < e/2 by INTEGRA3:def 1;
A161: for y be Real st y in rng upper_volume(XBC,T2.n) holds y <  e
      proof
        reconsider D=T2.n as Division of ['b,c'];
        let y be Real;
        assume y in rng upper_volume(XBC,T2.n);
        then consider x be object such that
A162:   x in dom upper_volume(XBC,T2.n) and
A163:   y=(upper_volume(XBC,T2.n)).x by FUNCT_1:def 3;
        reconsider i=x as Element of NAT by A162;
A164:   x in Seg len upper_volume(XBC,T2.n) by A162,FINSEQ_1:def 3;
        consider E1 be Division of ['b,c'] such that
A165:   E1=S2.n and
A166:   2 <= len E1 by A23;
        set i1=i+1;
        consider E be Division of BC such that
A167:   E=S2.n and
A168:   T2.n=E/^1 by A31;
A169:   1 <= len E1 by A166,XXREAL_0:2;
        then
A170:   len D = len E -1 by A167,A168,A165,RFINSEQ:def 1;
A171:   len (upper_volume(XBC,T2.n)) = len D by INTEGRA1:def 6;
        then
A172:   dom (upper_volume(XBC,T2.n)) = dom D by FINSEQ_3:29;
A173:   now
          len(upper_volume(XBC,S2.n)) = len E by A167,INTEGRA1:def 6;
          then 2 in Seg len (upper_volume(XBC,S2.n))
          by A167,A165,A166,FINSEQ_1:1;
          then 2 in dom upper_volume(XBC,S2.n) by FINSEQ_1:def 3;
          then (upper_volume(XBC,S2.n)).2 in rng upper_volume(XBC,S2.n) by
FUNCT_1:def 3;
          then (upper_volume(XBC,S2.n)).2 <= max rng upper_volume(XBC,S2.n)
          by XXREAL_2:def 8;
          then
A174:     (upper_volume(XBC,S2.n)).2 < e/2 by A160,XXREAL_0:2;
          assume
A175:     i = 1;
          then
A176:     1 in dom D by A164,A171,FINSEQ_1:def 3;
          len(upper_volume(XBC,S2.n))= len D + 1 by A167,A170,INTEGRA1:def 6;
          then len(upper_volume(XBC,S2.n)) = len (upper_volume(XBC,T2.n)) + 1
          by INTEGRA1:def 6;
          then 1 in Seg len(upper_volume(XBC,S2.n)) by A164,A175,FINSEQ_2:8;
          then 1 in dom upper_volume(XBC,S2.n) by FINSEQ_1:def 3;
          then (upper_volume(XBC,S2.n)).1 in rng upper_volume(XBC,S2.n) by
FUNCT_1:def 3;
          then (upper_volume(XBC,S2.n)).1 <= max rng upper_volume(XBC,S2.n)
          by XXREAL_2:def 8;
          then
A177:     (upper_volume(XBC,S2.n)).1 < e/2 by A160,XXREAL_0:2;
A178:     2 in dom E by A167,A165,A166,FINSEQ_3:25;
          1 in Seg len E by A167,A165,A169,FINSEQ_1:1;
          then
A179:     1 in dom E by FINSEQ_1:def 3;
          divset(S2.n,1) =
          [. lower_bound divset(S2.n,1),upper_bound divset(S2.n,1) .]
          by INTEGRA1:4;
          then
A180:     divset(S2.n,1) =
 [. lower_bound(['b,c']),upper_bound divset(S2.n,1) .] by A167,A179,
INTEGRA1:def 4;
          then
A181:     [. lower_bound(['b,c']),upper_bound divset(S2.n,1) .]
 = [.lower_bound([. lower_bound(['b,c
']),upper_bound divset(S2.n,1) .]), upper_bound([. lower_bound(['b,c']),
upper_bound divset(S2.n,1) .]).] by INTEGRA1:4;
A182:     divset((T2.n),i) =
 [. lower_bound(divset((T2.n),1)),upper_bound(divset((T2.n),
          1)) .] by A175,INTEGRA1:4
            .= [. lower_bound(['b,c']),upper_bound(divset((T2.n),1)) .]
            by A176,INTEGRA1:def 4
            .= [. lower_bound(['b,c']),D.1 .] by A176,INTEGRA1:def 4
            .= [. lower_bound(['b,c']),E.(1+1) .]
            by A167,A168,A165,A169,A176,RFINSEQ:def 1
            .= [. lower_bound(['b,c']),upper_bound(divset((S2.n),2)) .]
            by A167,A178,INTEGRA1:def 4;
          then [. lower_bound(['b,c']),upper_bound(divset((S2.n),2)) .]
           = [.lower_bound([. lower_bound(['b,c']),
           upper_bound(divset((S2.n),2)) .]),
upper_bound([. lower_bound(['b,c']),upper_bound(divset((S2.n),2))
          .]).] by INTEGRA1:4;
          then
A183:     lower_bound(['b,c'])=lower_bound([. lower_bound(['b,c']),
upper_bound(divset(( S2.n),2)) .]
) & upper_bound(divset ((S2.n),2)) =upper_bound([. lower_bound(['b,c']),
upper_bound(divset((S2.n),2)) .]) by A182,INTEGRA1:5;
          y =vol divset(T2.n,1) by A162,A163,A172,A175,INTEGRA1:20;
          then
          y = upper_bound(divset(T2.n,1)) - lower_bound(divset(T2.n,1))
            by INTEGRA1:def 5; then
          y =(upper_bound divset(S2.n,2)-upper_bound divset(S2.n,1)) +
           (upper_bound([. lower_bound(['b,c']),
           upper_bound divset(S2.n,1) .])-lower_bound(['b,c']))
          by A175,A182,A183,A180;
          then
          y =(upper_bound divset(S2.n,2) - upper_bound divset(S2.n,1))
           + (upper_bound(divset(S2.n,1))-lower_bound(divset(S2.n,1)))
            by A180,A181,INTEGRA1:5;
          then

A184:     y =(upper_bound divset(S2.n,2) - upper_bound divset(S2.n,1))
           + vol divset(S2.n,1) by INTEGRA1:def 5;

          divset(S2.n,2) = [. lower_bound divset(S2.n,2),
          upper_bound divset(S2.n,2) .] by INTEGRA1:4;
          then divset(S2.n,2) = [. E.(2-1),upper_bound divset(S2.n,2) .]
          by A167,A178,INTEGRA1:def 4;
          then

A185:     divset(S2.n,2)
           = [. upper_bound divset(S2.n,1),upper_bound divset( S2.n,2) .]
          by A167,A179,INTEGRA1:def 4;
          then
          [. upper_bound divset(S2.n,1) ,upper_bound divset(S2.n,2) .]
           = [.lower_bound([. upper_bound divset(S2.n,1)
                             ,upper_bound divset(S2.n,2) .]),
               upper_bound([. upper_bound divset(S2.n,1)
                             ,upper_bound divset(S2.n,2) .]).] by INTEGRA1:4;
          then y = upper_bound divset(S2.n,2) - lower_bound divset(S2.n,2)
           + vol divset(S2.n,1) by A185,A184,INTEGRA1:5;
          then y = vol divset(S2.n,2) + vol divset(S2.n,1) by
INTEGRA1:def 5;
          then y = (upper_volume(XBC,S2.n)).2 + vol divset(S2.n,1) by A167,A178
,INTEGRA1:20;
          then y = (upper_volume(XBC,S2.n)).2 + (upper_volume(XBC,S2.n)).1 by
A167,A179,INTEGRA1:20;
          then y < (e/2)+(e/2) by A174,A177,XREAL_1:8;
          hence thesis;
        end;
A186:   y=( upper_bound rng(XBC|divset(T2.n,i)) ) * vol divset(T2.n,i) by A162
,A163,A172,INTEGRA1:def 6;
        now
          len upper_volume(XBC,S2.n) = len D +1 by A167,A170,INTEGRA1:def 6;
          then len upper_volume(XBC,S2.n) = len (upper_volume(XBC,T2.n)) + 1
          by INTEGRA1:def 6;
          then
A187:     i1 in Seg len (upper_volume(XBC,S2.n)) by A164,FINSEQ_1:60;
          then
A188:     i1 in dom upper_volume(XBC,S2.n) by FINSEQ_1:def 3;
A189:     i1 in dom upper_volume(XBC,S2.n) by A187,FINSEQ_1:def 3;
A190:     i in dom D by A164,A171,FINSEQ_1:def 3;
          Seg (len D + 1) = Seg len E by A170;
          then i1 in Seg len E by A164,A171,FINSEQ_1:60;
          then
A191:     i1 in dom E by FINSEQ_1:def 3;
          len upper_volume(XBC,S2.n) = len E by A167,INTEGRA1:def 6;
          then
A192:     dom upper_volume(XBC,S2.n) = dom E by FINSEQ_3:29;
          assume
A193:     i <> 1;
          i in Seg len D by A162,A171,FINSEQ_1:def 3;
          then 1 <= i by FINSEQ_1:1;
          then
A194:     1 < i by A193,XXREAL_0:1;
          then
A195:     i-1 in Seg len D by A164,A171,FINSEQ_3:12;
          then
A196:     i-1 in dom D by FINSEQ_1:def 3;
          reconsider i9 = i-1 as Element of NAT by A195;
          1+1 < i+1 by A194,XREAL_1:8;
          then
A197:     i1 <> 1;
          divset(T2.n,i) = [. lower_bound divset(T2.n,i),
          upper_bound divset(T2.n,i) .] by INTEGRA1:4
            .= [. D.(i-1),upper_bound divset(T2.n,i) .]
            by A193,A190,INTEGRA1:def 4
            .= [. D.(i-1),D.i .] by A193,A190,INTEGRA1:def 4
            .= [. E.(i9+1),D.i .] by A167,A168,A165,A169,A196,RFINSEQ:def 1
            .= [. E.((i-1)+1),E.(i+1) .] by A167,A168,A165,A169,A190,
RFINSEQ:def 1
            .= [. E.(i1-1),upper_bound divset(S2.n,i1) .]
            by A167,A197,A191,INTEGRA1:def 4
            .= [. lower_bound divset(S2.n,i1),upper_bound divset(S2.n,i1) .]
             by A167,A197,A191,INTEGRA1:def 4
            .= divset(S2.n,i1) by INTEGRA1:4;
          then y = (upper_volume(XBC,S2.n)).i1 by A186,A167,A188,A192,
INTEGRA1:def 6;
          then y in rng upper_volume(XBC,S2.n) by A189,FUNCT_1:def 3;
          then y <= max rng upper_volume(XBC,S2.n) by XXREAL_2:def 8;
          then y < e/2 by A160,XXREAL_0:2;
          hence thesis by A158,XXREAL_0:2;
        end;
        hence thesis by A173;
      end;
      max rng upper_volume(XBC,T2.n) in rng upper_volume(XBC,T2.n) by
XXREAL_2:def 8; then
      max rng upper_volume(XBC,T2.n) < e by A161;
      then 0 <= delta(T2.n) & delta(T2.n) < e by INTEGRA3:9,def 1;
      then |.delta(T2.n).| < e by ABSVALUE:def 1;
      hence |.delta(T2).nn-0 .| < e by INTEGRA3:def 2;
  end;
  then
A198: delta T2 is convergent by SEQ_2:def 6;
  then
A199: lim delta T2 =0 by A155,SEQ_2:def 7;

  (f||BC)|BC is bounded by A4; then
A200: upper_sum(f||BC,T2) is convergent & lim upper_sum(f||BC,T2) =
  upper_integral f||BC by A13,A198,A199,INTEGRA4:9;

  set XAB = chi(['a,b'],['a,b']);
  set XAC = chi(['a,c'],['a,c']);

A201: now
    let e be Real;
    assume
A202: 0 < e;
    then consider n1 be Nat such that
A203: for m be Nat st n1 <= m holds |.delta(T1).m -0 .| < e by A46,SEQ_2:def 7;
    consider n2 be Nat such that
A204: for m be Nat st n2 <= m holds |.delta(T2).m -0 .| < e by A155,A202;
    reconsider n = max(n1,n2) as Nat by TARSKI:1;
    take n;
      let mm be Nat;
      assume
A205: n <=mm;
      reconsider m=mm as Element of NAT by ORDINAL1:def 12;
      n2 <= n by XXREAL_0:25;
      then n2 <= m by A205,XXREAL_0:2;
      then |.delta(T2).m -0 .| < e by A204;
      then
      |.delta(T2.m) .| < e by INTEGRA3:def 2;
      then
      delta(T2.m) < e by INTEGRA3:9,ABSVALUE:def 1; then
A206: max rng upper_volume(XBC,T2.m) < e by INTEGRA3:def 1;
      n1 <= n by XXREAL_0:25;
      then n1 <= m by A205,XXREAL_0:2;
      then |.delta(T1).m -0 .| < e by A203;
      then
      |.delta(T1.m) .| < e by INTEGRA3:def 2;
      then
      delta(T1.m) < e by INTEGRA3:9,ABSVALUE:def 1; then
A207: max rng upper_volume(XAB,T1.m) < e by INTEGRA3:def 1;
A208: for r be Real st r in rng upper_volume(XAC,T.m) holds r < e
      proof
        reconsider Tm=T.m as Division of [' a,c '];
        let y be Real;
        assume y in rng upper_volume(XAC,T.m);
        then consider x be object such that
A209:   x in dom upper_volume(XAC,T.m) and
A210:   y = (upper_volume(XAC,T.m)).x by FUNCT_1:def 3;
        reconsider i=x as Element of NAT by A209;
A211:   x in Seg len (upper_volume(XAC,T.m)) by A209,FINSEQ_1:def 3;
        then
A212:   1 <= i by FINSEQ_1:1;
A213:   len(upper_volume(XAC,T.m)) =len Tm by INTEGRA1:def 6;
        then
A214:   i <= len Tm by A211,FINSEQ_1:1;
        dom(upper_volume(XAC,T.m)) =dom Tm by A213,FINSEQ_3:29;
        then
A215:   y=(upper_bound rng(XAC|divset(T.m,i))) * vol divset(T.m,i)
          by A209,A210,INTEGRA1:def 6;
        consider S1 be Division of [' a,b '], S2 be Division of [' b,c '] such
        that
A216:   S1=T1.m and
A217:   S2=T2.m and
A218:   T.m = S1^S2 by A82;
A219:   len Tm = len S1 + len S2 by A218,FINSEQ_1:22;
        per cases;
        suppose
          i <= len S1;
          then
A220:     i in Seg len S1 by A212,FINSEQ_1:1;
          then
A221:     i in dom S1 by FINSEQ_1:def 3;
          len (upper_volume(XAB,T1.m)) = len S1 by A216,INTEGRA1:def 6;
          then
A222:     i in dom (upper_volume(XAB,T1.m)) by A220,FINSEQ_1:def 3;
A223:     divset(T1.m,i) = divset(T.m,i) by A83,A216,A220;
A224:     divset(T1.m,i) c= [' a,b '] by A124,A216,A220;
          then divset(T1.m,i) c= [' a,c '] by A12;
          then XAB|divset(T1.m,i) = XAC|divset(T.m,i) by A223,A224,INTEGRA6:4;
          then y=(upper_volume(XAB,T1.m)).i by A215,A216,A221,A223,
INTEGRA1:def 6;
          then y in rng upper_volume(XAB,T1.m) by A222,FUNCT_1:def 3;
          then y <= max rng upper_volume(XAB,T1.m) by XXREAL_2:def 8;
          hence thesis by A207,XXREAL_0:2;
        end;
        suppose
          i > len S1;
          then
A225:     len S1 + 1 <=i by NAT_1:13;
          then consider k be Nat such that
A226:     (len S1 + 1)+k=i by NAT_1:10;
          reconsider k as Element of NAT by ORDINAL1:def 12;
          set i1=1+k;
A227:     i-len S1 <= len S2 by A219,A214,XREAL_1:20;
          1+k = i - len S1 by A226;
          then 1 <= 1+k by A225,XREAL_1:19;
          then
A228:     1+k in Seg len S2 by A226,A227,FINSEQ_1:1;
          then
A229:     1+k in dom S2 by FINSEQ_1:def 3;
A230:     divset(T2.m,i1) =divset(T.m,len S1 + i1) by A99,A216,A217,A228;
A231:     divset(T2.m,i1) c= [' b,c '] by A121,A217,A228;
          then divset(T2.m,i1) c= [' a,c '] by A12;
          then y=(upper_bound rng(XBC|divset(T2.m,i1))) * vol divset(T2.m,i1)
           by A215,A226,A230,A231,INTEGRA6:4;
          then
A232:     y=(upper_volume(XBC,T2.m)).i1 by A217,A229,INTEGRA1:def 6;
          len (upper_volume(XBC,T2.m)) = len S2 by A217,INTEGRA1:def 6;
          then i1 in dom (upper_volume(XBC,T2.m)) by A228,FINSEQ_1:def 3;
          then y in rng upper_volume(XBC,T2.m) by A232,FUNCT_1:def 3;
          then y <= max rng upper_volume(XBC,T2.m) by XXREAL_2:def 8;
          hence thesis by A206,XXREAL_0:2;
        end;
      end;
      max rng upper_volume(XAC,T.m) in rng upper_volume(XAC,T.m)
        by XXREAL_2:def 8;
      then max rng upper_volume(XAC,T.m) < e by A208;
      then delta(T.m) < e by INTEGRA3:def 1;
      then |. delta(T.m) .| < e by INTEGRA3:9,ABSVALUE:def 1;
      hence |.delta(T).mm -0 .| < e by INTEGRA3:def 2;
  end;
  then
A233: delta T is convergent by SEQ_2:def 6;
  then
A234: lim delta(T)=0 by A201,SEQ_2:def 7;
  (f||AC)|AC is bounded by A10,A3,A4,RFUNCT_1:87; then
A235: upper_integral f||AC = lim upper_sum(f||AC,T)
  by A8,A233,A234,INTEGRA4:9;


A236: for i be Element of NAT holds
        lower_volume(f||AC,T.i)
         =(lower_volume(f||AB,T1.i))^(lower_volume(f||BC,T2.i))
  proof
    let i be Element of NAT;
    reconsider F = lower_volume(f||AC,T.i) as FinSequence of REAL;
    reconsider F1 = lower_volume(f||AB,T1.i) as FinSequence of REAL;
    reconsider F2 = lower_volume(f||BC,T2.i) as FinSequence of REAL;
    reconsider S=T.i as Division of [' a,c '];
    consider S1 be Division of [' a,b '], S2 be Division of [' b,c '] such
    that
A237: S1=T1.i and
A238: S2=T2.i and
A239: T.i = S1^S2 by A82;
A240: len F = len S by INTEGRA1:def 7
      .= len S1+ len S2 by A239,FINSEQ_1:22
      .= len F1 + len S2 by A237,INTEGRA1:def 7;
    then
A241: len F = len F1 + len F2 by A238,INTEGRA1:def 7;
A242: now
      let k be Nat;
      assume k in dom F2;
      then
A243: k in Seg len F2 by FINSEQ_1:def 3;
      then 1 <=k by FINSEQ_1:1;
      then
A244: 1 + len F1 <= k + len F1 by XREAL_1:6;
A245:k <= len F2 by A243,FINSEQ_1:1;
      1 <= 1+ len F1 by NAT_1:11;
      then 1 <= k + len F1 by A244,XXREAL_0:2;
      then k+ len F1 in Seg len F by A245,A241,XREAL_1:6,FINSEQ_1:1;
      then len F1 + k in Seg len S by INTEGRA1:def 7;
      then len F1 + k in dom S by FINSEQ_1:def 3;
      then
A246: F.(len F1 + k) = (lower_bound rng((f||AC)|divset(T.i,len F1 + k))) * vol
      divset(T.i,(len F1 + k)) by INTEGRA1:def 7;
A247: k in Seg len S2 by A238,A243,INTEGRA1:def 7;
      then
A248: k in dom S2 by FINSEQ_1:def 3;
      len F1= len S1 by A237,INTEGRA1:def 7;
      then
A249: divset(T.i,len F1 + k) = divset(T2.i,k) by A99,A237,A238,A247;
A250: divset(T2.i,k) c= [' b,c '] by A121,A238,A247;
      then divset(T.i,len F1 + k) c= [' a,c '] by A12,A249;
      then F.(len F1 + k)=
      (lower_bound rng((f||BC)|divset(T2.i,k))) * vol divset(T2.i,k)
      by A246,A249,A250,INTEGRA6:3;
      hence F.(len F1 + k)=F2.k by A238,A248,INTEGRA1:def 7;
    end;
A251: now
      let k be Nat;
      len lower_volume(f||AC,T.i) = len S by INTEGRA1:def 7;
      then
A252: dom lower_volume(f||AC,T.i) = dom S by FINSEQ_3:29;
      assume
A253: k in dom F1;
      then k in Seg len F1 by FINSEQ_1:def 3;
      then
A254: k in Seg len S1 by A237,INTEGRA1:def 7;
      then
A255: k in dom S1 by FINSEQ_1:def 3;
      dom F1 c= dom F by A240,NAT_1:11,FINSEQ_3:30;
      then
A256: F.k=(lower_bound rng((f||AC)|divset(T.i,k))) * vol divset(T.i,k)
by A253,A252
,INTEGRA1:def 7;
A257: divset(T.i,k) = divset(T1.i,k) & divset(T1.i,k) c=[' a,b '] by A124,A83
,A237,A254;
      then divset(T.i,k) c= [' a,c '] by A12;
      then F.k=(lower_bound rng((f||AB)|divset(T1.i,k))) * vol divset(T1.i,k)
      by A256,A257,INTEGRA6:3;
      hence F.k=F1.k by A237,A255,INTEGRA1:def 7;
    end;
    dom F = Seg (len F1 + len F2) by A241,FINSEQ_1:def 3;
    hence thesis by A251,A242,FINSEQ_1:def 7;
  end;

A258: for i be Element of NAT holds Sum lower_volume(f||AC,T.i) = Sum
  lower_volume(f||AB,T1.i) + Sum lower_volume(f||BC,T2.i)
  proof
    let i be Element of NAT;
    lower_volume(f||AC,T.i) = (lower_volume(f||AB,T1.i))^(lower_volume(f||BC,
    T2.i)) by A236;
    hence thesis by RVSUM_1:75;
  end;
  now
    let i be Nat;
     reconsider ii=i as Element of NAT by ORDINAL1:def 12;
    thus lower_sum(f||AC,T).i =lower_sum(f||AC,T.ii) by INTEGRA2:def 3
      .= Sum(lower_volume(f||AC,T.ii)) by INTEGRA1:def 9
      .= Sum
  lower_volume(f||AB,T1.i) + Sum lower_volume(f||BC,T2.i) by A258
      .=lower_sum(f||AB,T1.ii) + Sum lower_volume(f||BC,T2.ii) by
      INTEGRA1:def 9
      .= lower_sum(f||AB,T1.ii) + lower_sum(f||BC,T2.ii) by INTEGRA1:def 9
      .=lower_sum(f||AB,T1).i + lower_sum(f||BC,T2.ii) by INTEGRA2:def 3
      .=lower_sum(f||AB,T1).i + lower_sum(f||BC,T2).i by INTEGRA2:def 3;
  end;
  then
A259: lower_sum(f||AC,T) = lower_sum(f||AB,T1) + lower_sum(f||BC,T2)
by SEQ_1:7;
A260:  (f||AB)|AB is bounded by A3; then
 upper_sum(f||AB,T1) is convergent & lim upper_sum(f||AB,T1) =
  upper_integral (f||AB) by A13,A46,INTEGRA4:9;
  then
A261: upper_integral(f||AB) + upper_integral(f||BC) = upper_integral(f||AC)
by A150,A200,A235,SEQ_2:6;

A262: lower_sum(f||AB,T1) is convergent & lim lower_sum(f||AB,T1) =
  lower_integral(f||AB) by A13,A260,A46,INTEGRA4:8;

  (f||AC)|AC is bounded by A10,A3,A4,RFUNCT_1:87;
  then
A263: lower_integral(f||AC) = lim lower_sum(f||AC,T)
  by A8,A233,A234,INTEGRA4:8;
  (f||BC)|BC is bounded by A4; then
  lower_sum(f||BC,T2) is convergent & lim lower_sum(f||BC,T2) =
  lower_integral(f||BC) by A13,A198,A199,INTEGRA4:8;
  then
A264: lower_integral(f||AB) + lower_integral(f||BC) = lower_integral(f||AC)
 by A259,A262,A263,SEQ_2:6;

A265: f||['a,b'] is integrable & f||['b,c'] is integrable
      by A5,A6,INTEGRA5:def 1; then
    f||['a,b'] is upper_integrable lower_integrable &
    upper_integral(f||['a,b']) = lower_integral(f||['a,b'])
      by INTEGRA1:def 16; then
    upper_integral(f||['a,c']) = lower_integral(f||['a,c'])
      by A264,A261,A265,INTEGRA1:def 16;
    hence f is_integrable_on ['a,c'] by A11,INTEGRA1:def 16,INTEGRA5:def 1;
end;

theorem Th1:
for f be PartFunc of REAL,REAL, a,b,c be Real
 st a <= b <= c & ['a,c'] c= dom f & f|['a,b'] is bounded &
 f|['b,c'] is bounded &
 f is_integrable_on ['a,b'] & f is_integrable_on ['b,c']
 holds f is_integrable_on ['a,c']
 & integral(f,a,c) = integral(f,a,b) + integral(f,b,c)
proof
    let f be PartFunc of REAL,REAL, a,b,c be Real;
    assume that
A1:  a <= b <= c and
A2:  ['a,c'] c= dom f and
A3:  f|['a,b'] is bounded and
A4:  f|['b,c'] is bounded and
A5:  f is_integrable_on ['a,b'] and
A6:  f is_integrable_on ['b,c'];

    thus
A7:  f is_integrable_on ['a,c']
    proof
     per cases;
     suppose A8: a <> b;
      per cases;
      suppose b <> c; then
       a < b < c by A1,A8,XXREAL_0:1;
       hence thesis by A2,A3,A4,A5,A6,Lm1;
      end;
      suppose b = c;
       hence thesis by A5;
      end;
     end;
     suppose a = b;
      hence thesis by A6;
     end;
    end;

A9: a <= c by A1,XXREAL_0:2;
A10: ['a,c'] = [.a,c.] by A1,XXREAL_0:2,INTEGRA5:def 3; then
A11: b in ['a,c'] by A1,XXREAL_1:1;

    ['a,b'] = [.a,b.] & ['b,c'] = [.b,c.] by A1,INTEGRA5:def 3; then
    ['a,c'] = ['a,b'] \/ ['b,c'] by A1,A10,XXREAL_1:165; then
    f|['a,c'] is bounded by A3,A4,RFUNCT_1:87;
    hence integral(f,a,c) = integral(f,a,b) + integral(f,b,c)
      by A2,A7,A9,A11,INTEGRA6:17;
end;

theorem Th2:
for seq be Real_Sequence st seq is divergent_to+infty
 holds not seq is divergent_to-infty & not seq is convergent
proof
    let seq be Real_Sequence;
    assume A1: seq is divergent_to+infty;
    hereby assume seq is divergent_to-infty; then
     consider n1 be Nat such that
A2:   for m be Nat st n1<=m holds seq.m < 0 by LIMFUNC1:def 5;
     consider n2 be Nat such that
A3:   for m be Nat st n2<=m holds seq.m > 0 by A1,LIMFUNC1:def 4;
     reconsider m = max(n1,n2) as Element of NAT by ORDINAL1:def 12;
     seq.m < 0 & seq.m > 0 by A2,A3,XXREAL_0:25;
     hence contradiction;
    end;
    assume seq is convergent; then
    consider g be Real such that
A4:  for p be Real st 0<p ex n be Nat st for m be Nat st n<=m holds
      |.seq.m-g.| < p by SEQ_2:def 6;

    per cases;
    suppose g > 0; then
     consider n1 be Nat such that
A5:   for m be Nat st n1 <= m holds |.seq.m- g.| < g by A4;
A6:  now
      let m be Nat;
      assume n1 <= m; then
A7:   |.seq.m- g.| <  g by A5;
      seq.m-g <= |.seq.m-g.| by ABSVALUE:4; then
      seq.m-g < g by A7,XXREAL_0:2;
      then seq.m < g+g by XREAL_1:19;
      hence seq.m < (2*g);
     end;
     consider n2 be Nat such that
A8:   for m be Nat st n2 <= m holds (2*g) < seq.m by A1,LIMFUNC1:def 4;
     reconsider n1,n2 as Element of NAT by ORDINAL1:def 12;
     reconsider m = max(n1,n2) as Element of NAT;
     seq.m < (2*g) by A6,XXREAL_0:25;
     hence contradiction by A8,XXREAL_0:25;
    end;
    suppose g < 0; then
     consider n1 be Nat such that
A9:  for m be Nat st n1 <= m holds |.seq.m- g.| <  -g by A4,XREAL_1:58;
A10: now
      let m be Element of NAT;
      assume n1 <= m; then
A11:   |.seq.m- g.| <  -g by A9;
      seq.m - g <= |.seq.m-g.| by ABSVALUE:4; then
      seq.m -  g < -g by A11,XXREAL_0:2;
      then seq.m < g-g by XREAL_1:19;
      hence seq.m < 0;
     end;
     consider n2 be Nat such that
A12:  for m be Nat st n2 <= m holds 0 < seq.m by A1,LIMFUNC1:def 4;

     reconsider n1,n2 as Element of NAT by ORDINAL1:def 12;
     reconsider m = max(n1,n2) as Element of NAT;
     seq.m < 0 by A10,XXREAL_0:25;
     hence contradiction by A12,XXREAL_0:25;
    end;
    suppose A13: g = 0;
     consider n1 be Nat such that
A14:  for m be Nat st n1 <= m holds |. seq.m- g .| <  1 by A4;
     consider n2 be Nat such that
A15:  for m be Nat st n2 <= m holds  1 < seq.m by A1,LIMFUNC1:def 4;
     reconsider n1,n2 as Element of NAT by ORDINAL1:def 12;
     reconsider m = max(n1,n2) as Element of NAT;
A16: |. seq.m- g .| <  1 by A14,XXREAL_0:25;
     seq.m - g <= |.seq.m-g.| by ABSVALUE:4;
     then seq.m -  g <  1 by A16,XXREAL_0:2;
     hence contradiction by A13,A15,XXREAL_0:25;
    end;
end;

theorem Th3:
for seq be Real_Sequence st seq is divergent_to-infty
 holds not seq is divergent_to+infty & not seq is convergent
proof
    let seq be Real_Sequence;
    assume A1: seq is divergent_to-infty;
    hereby assume seq is divergent_to+infty; then
     consider n1 be Nat such that
A2:   for m be Nat st n1<=m holds 0 < seq.m by LIMFUNC1:def 4;
     consider n2 be Nat such that
A3:   for m be Nat st n2<=m holds seq.m < 0 by A1,LIMFUNC1:def 5;
     reconsider m = max(n1,n2) as Element of NAT by ORDINAL1:def 12;
     seq.m < 0 & seq.m > 0 by A2,A3,XXREAL_0:25;
     hence contradiction;
    end;
    assume seq is convergent; then
    consider g be Real such that
A4:  for p be Real st 0<p ex n be Nat st for m be Nat st n<=m holds
      |.seq.m-g.| < p by SEQ_2:def 6;

    per cases;
    suppose A5: g > 0; then
     consider n1 be Nat such that
A6:   for m be Nat st n1 <= m holds |.seq.m- g.| < g by A4;
A7:  now
      let m be Nat;
      assume n1 <= m; then
      |.seq.m- g.| <  g by A6; then
A8:   -g < -|.seq.m-g.| by XREAL_1:24;
      -|.seq.m-g.| <= seq.m-g by ABSVALUE:4; then
      -g < seq.m-g by A8,XXREAL_0:2; then
      -g+g < seq.m by XREAL_1:20;
      hence 0 < seq.m;
     end;
     consider n2 be Nat such that
A9:   for m be Nat st n2 <= m holds seq.m <  -g by A1,LIMFUNC1:def 5;
     reconsider n1,n2 as Element of NAT by ORDINAL1:def 12;
     reconsider m = max(n1,n2) as Element of NAT;
     0 < seq.m by A7,XXREAL_0:25;
     hence contradiction by A5,A9,XXREAL_0:25;
    end;
    suppose g < 0; then
     consider n1 be Nat such that
A10:  for m be Nat st n1 <= m holds |.seq.m- g.| <  -g by A4,XREAL_1:58;
A11: now
      let m be Element of NAT;
      assume n1 <= m; then
      |.seq.m- g.| <  -g by A10; then
A12:   --g < -|.seq.m-g.| by XREAL_1:24;
      -|.seq.m-g.| <= seq.m-g by ABSVALUE:4; then
      --g < seq.m - g by A12,XXREAL_0:2; then
      g+g < seq.m by XREAL_1:20;
      hence (2*g) < seq.m;
     end;
     consider n2 be Nat such that
A13:  for m be Nat st n2 <= m holds seq.m < 2*g by A1,LIMFUNC1:def 5;

     reconsider n1,n2 as Element of NAT by ORDINAL1:def 12;
     reconsider m = max(n1,n2) as Element of NAT;
     (2*g) < seq.m by A11,XXREAL_0:25;
     hence contradiction by A13,XXREAL_0:25;
    end;
    suppose A14: g = 0;
     consider n1 be Nat such that
A15:  for m be Nat st n1 <= m holds |. seq.m- g .| <  1 by A4;
     consider n2 be Nat such that
A16:  for m be Nat st n2 <= m holds  seq.m < -1 by A1,LIMFUNC1:def 5;
     reconsider n1,n2 as Element of NAT by ORDINAL1:def 12;
     reconsider m = max(n1,n2) as Element of NAT;
A17: |. seq.m-0 .| <  1 by A14,A15,XXREAL_0:25;

A18: seq.m < -1 by A16,XXREAL_0:25;
     --1 < -seq.m by A18,XREAL_1:24;
     hence contradiction by A17,A18,ABSVALUE:def 1;
    end;
end;

theorem Th4:
for f be PartFunc of REAL,REAL, x0 be Real
 st f is_left_convergent_in x0 or f is_left_divergent_to+infty_in x0 or
    f is_left_divergent_to-infty_in x0
 ex seq be Real_Sequence st seq is convergent & lim seq = x0
  & rng seq c= dom f /\ left_open_halfline x0
proof
    let f be PartFunc of REAL,REAL, x0 be Real;
    assume
A1:  f is_left_convergent_in x0 or f is_left_divergent_to+infty_in x0 or
     f is_left_divergent_to-infty_in x0;
    defpred F[Nat,Real] means x0-1/($1+1)<$2 & $2<x0 & $2 in dom f;
A2: for n be Element of NAT ex r be Element of REAL st F[n,r]
    proof
     let n be Element of NAT;
     consider r be Real such that
A3:   x0-1/(n+1) < r & r < x0 & r in dom f
       by A1,XREAL_1:44,LIMFUNC2:def 1,def 2,def 3;

     thus ex r be Element of REAL st
      x0-1/(n+1) < r & r < x0 & r in dom f by A3;
    end;
    consider seq be Real_Sequence such that
A4:  for n be Element of NAT holds F[n,seq.n] from FUNCT_2:sch 3(A2);
    take seq;
    for n be Nat holds x0-1/(n+1)<seq.n & seq.n<x0 & seq.n in dom f
    proof
     let n be Nat;
     n is Element of NAT by ORDINAL1:def 12;
     hence thesis by A4;
    end;
    hence thesis by LIMFUNC2:5;
end;

theorem Th5:
for f be PartFunc of REAL,REAL, x0 be Real
 st f is_right_convergent_in x0 or f is_right_divergent_to+infty_in x0 or
    f is_right_divergent_to-infty_in x0
 ex seq be Real_Sequence st seq is convergent & lim seq = x0
  & rng seq c= dom f /\ right_open_halfline x0
proof
    let f be PartFunc of REAL,REAL, x0 be Real;
    assume
A1:  f is_right_convergent_in x0 or f is_right_divergent_to+infty_in x0 or
     f is_right_divergent_to-infty_in x0;
    defpred F[Nat,Real] means x0<$2 & $2<x0+1/($1+1) & $2 in dom f;
A2: for n be Element of NAT ex r be Element of REAL st F[n,r]
    proof
     let n be Element of NAT;
     consider r be Real such that
A3:   r < x0+1/(n+1) & x0 < r & r in dom f
        by A1,XREAL_1:29,LIMFUNC2:def 4,def 5,def 6;
     thus ex r be Element of REAL st
      x0 < r & r < x0+1/(n+1) & r in dom f by A3;
    end;
    consider seq be Real_Sequence such that
A4:  for n be Element of NAT holds F[n,seq.n] from FUNCT_2:sch 3(A2);
    take seq;
    for n be Nat holds x0<seq.n & seq.n<x0+1/(n+1) & seq.n in dom f
    proof
     let n be Nat;
     n is Element of NAT by ORDINAL1:def 12;
     hence thesis by A4;
    end;
    hence thesis by LIMFUNC2:6;
end;

theorem Th6:
for f be PartFunc of REAL,REAL, x0 be Real
 st f is_left_divergent_to+infty_in x0  holds
   not f is_left_divergent_to-infty_in x0 & not f is_left_convergent_in x0
proof
    let f be PartFunc of REAL,REAL, x0 be Real;
    assume A1: f is_left_divergent_to+infty_in x0; then
    consider seq be Real_Sequence such that
A2:  seq is convergent & lim seq = x0
   & rng seq c= dom f /\ left_open_halfline x0 by Th4;
A3: f/*seq is divergent_to+infty by A1,A2,LIMFUNC2:def 2;
    hence not f is_left_divergent_to-infty_in x0 by A2,Th2,LIMFUNC2:def 3;

    not ex g be Real st for seq be Real_Sequence
     st seq is convergent & lim seq=x0
      & rng seq c= dom f /\ left_open_halfline x0
      holds f/*seq is convergent & lim(f/*seq)=g by A2,A3,Th2;
    hence not f is_left_convergent_in x0 by LIMFUNC2:def 1;
end;

theorem Th7:
for f be PartFunc of REAL,REAL, x0 be Real
 st f is_left_divergent_to-infty_in x0  holds
   not f is_left_divergent_to+infty_in x0 & not f is_left_convergent_in x0
proof
    let f be PartFunc of REAL,REAL, x0 be Real;
    assume A1: f is_left_divergent_to-infty_in x0; then
    consider seq be Real_Sequence such that
A2:  seq is convergent & lim seq = x0
   & rng seq c= dom f /\ left_open_halfline x0 by Th4;
A3: f/*seq is divergent_to-infty by A1,A2,LIMFUNC2:def 3;
    hence not f is_left_divergent_to+infty_in x0 by A2,Th3,LIMFUNC2:def 2;

    not ex g be Real st for seq be Real_Sequence
     st seq is convergent & lim seq=x0
      & rng seq c= dom f /\ left_open_halfline x0
      holds f/*seq is convergent & lim(f/*seq)=g by A2,A3,Th3;
    hence not f is_left_convergent_in x0 by LIMFUNC2:def 1;
end;

theorem Th8:
for f be PartFunc of REAL,REAL, x0 be Real
 st f is_right_divergent_to+infty_in x0 holds
   not f is_right_divergent_to-infty_in x0 & not f is_right_convergent_in x0
proof
    let f be PartFunc of REAL,REAL, x0 be Real;
    assume A1: f is_right_divergent_to+infty_in x0; then
    consider seq be Real_Sequence such that
A2:  seq is convergent & lim seq = x0
   & rng seq c= dom f /\ right_open_halfline x0 by Th5;
A3: f/*seq is divergent_to+infty by A1,A2,LIMFUNC2:def 5;
    hence not f is_right_divergent_to-infty_in x0 by A2,Th2,LIMFUNC2:def 6;

    not ex g be Real st for seq be Real_Sequence
     st seq is convergent & lim seq=x0
      & rng seq c= dom f /\ right_open_halfline x0
      holds f/*seq is convergent & lim(f/*seq)=g by A2,A3,Th2;
    hence not f is_right_convergent_in x0 by LIMFUNC2:def 4;
end;

theorem Th9:
for f be PartFunc of REAL,REAL, x0 be Real
 st f is_right_divergent_to-infty_in x0 holds
   not f is_right_divergent_to+infty_in x0 & not f is_right_convergent_in x0
proof
    let f be PartFunc of REAL,REAL, x0 be Real;
    assume A1: f is_right_divergent_to-infty_in x0; then
    consider seq be Real_Sequence such that
A2:  seq is convergent & lim seq = x0
   & rng seq c= dom f /\ right_open_halfline x0 by Th5;
A3: f/*seq is divergent_to-infty by A1,A2,LIMFUNC2:def 6;
    hence not f is_right_divergent_to+infty_in x0 by A2,Th3,LIMFUNC2:def 5;

    not ex g be Real st for seq be Real_Sequence
     st seq is convergent & lim seq=x0
      & rng seq c= dom f /\ right_open_halfline x0
      holds f/*seq is convergent & lim(f/*seq)=g by A2,A3,Th3;
    hence not f is_right_convergent_in x0 by LIMFUNC2:def 4;
end;

theorem Th10:
for f be PartFunc of REAL,REAL, x0 be Real st
 f is_right_convergent_in x0 holds
  (ex r be Real st 0<r & f|(].x0,x0+r.[) is bounded_below) &
  (ex r be Real st 0<r & f|(].x0,x0+r.[) is bounded_above)
proof
    let f be PartFunc of REAL,REAL, x0 be Real;
    assume
A1:  f is_right_convergent_in x0;
    consider g be Real such that
A2:  for g1 be Real st 0 < g1 ex r be Real st x0<r & for r1 be Real st
       r1<r & x0<r1 & r1 in dom f holds |.f.r1-g.| < g1 by A1,LIMFUNC2:10;
    consider r be Real such that
A3:  x0 < r and
A4:  for r1 be Real st r1<r & x0<r1 & r1 in dom f holds |.f.r1-g.| < 1
       by A2;
    set R = r-x0;

    for r1 be object st r1 in dom(f|(].x0,x0+R.[))
     holds -1+g < (f|(].x0,x0+R.[)).r1
    proof
     let r1 be object;
     assume A5: r1 in dom(f|(].x0,x0+R.[)); then
     reconsider r1 as Real;
     r1 in dom f /\ ].x0,x0+R.[ by A5,RELAT_1:61; then
A6:  r1 in dom f & r1 in ].x0,x0+R.[ by XBOOLE_0:def 4; then
A7:  x0 < r1 & r1 < x0+R by XXREAL_1:4; then
     |. f.r1 - g .| < 1 by A4,A6; then
A8:  -1 <= f.r1 - g by ABSVALUE:5;
     now assume -1 = f.r1 - g; then
      |. f.r1 - g .| = -(-1) by ABSVALUE:def 1;
      hence contradiction by A7,A4,A6;
     end; then
     -1 < f.r1-g by A8,XXREAL_0:1; then
     -1+g < f.r1 by XREAL_1:20;
     hence thesis by A6,FUNCT_1:49;
    end; then
    f|(].x0,x0+R.[) is bounded_below by SEQ_2:def 2;
    hence ex r be Real st 0<r & f|(].x0,x0+r.[) is bounded_below
      by A3,XREAL_1:50;

    consider r be Real such that
A9:  x0 < r and
A10:  for r1 be Real st r1<r & x0<r1 & r1 in dom f holds |.f.r1-g.| < 1
       by A2;
    set R = r-x0;

    for r1 be object st r1 in dom(f|(].x0,x0+R.[))
     holds (f|(].x0,x0+R.[)).r1 < g+1
    proof
     let r1 be object;
     assume A11: r1 in dom(f|(].x0,x0+R.[)); then
     reconsider r1 as Real;
     r1 in dom f /\ ].x0,x0+R.[ by A11,RELAT_1:61; then
A12:  r1 in dom f & r1 in ].x0,x0+R.[ by XBOOLE_0:def 4; then
     x0 < r1 & r1 < x0+R by XXREAL_1:4; then
     |. f.r1 - g .| < 1 by A10,A12; then
     f.r1-g < 1 by ABSVALUE:def 1; then
     f.r1 < g+1 by XREAL_1:19;
     hence thesis by A12,FUNCT_1:49;
    end; then
    f|(].x0,x0+R.[) is bounded_above by SEQ_2:def 1;
    hence ex r be Real st 0<r & f|(].x0,x0+r.[) is bounded_above
      by A9,XREAL_1:50;
end;

theorem Th11:
for f be PartFunc of REAL,REAL, x0 be Real st
 f is_left_convergent_in x0 holds
  (ex r be Real st 0<r & f|(].x0-r,x0.[) is bounded_below) &
  (ex r be Real st 0<r & f|(].x0-r,x0.[) is bounded_above)
proof
    let f be PartFunc of REAL,REAL, x0 be Real;
    assume
A1:  f is_left_convergent_in x0;
    consider g be Real such that
A2:  for g1 be Real st 0 < g1 ex r be Real st r<x0 & for r1 be Real st
       r<r1 & r1<x0 & r1 in dom f holds |.f.r1-g.| < g1 by A1,LIMFUNC2:7;

    consider r be Real such that
A3:  r < x0 and
A4:  for r1 be Real st r<r1 & r1<x0 & r1 in dom f holds |.f.r1-g.| < 1
       by A2;
    set R = x0-r;

    for r1 be object st r1 in dom(f|(].x0-R,x0.[))
     holds -1+g < (f|(].x0-R,x0.[)).r1
    proof
     let r1 be object;
     assume A5: r1 in dom(f|(].x0-R,x0.[)); then
     reconsider r1 as Real;
     r1 in dom f /\ ].x0-R,x0.[ by A5,RELAT_1:61; then
A6:  r1 in dom f & r1 in ].x0-R,x0.[ by XBOOLE_0:def 4; then
A7:  x0-R < r1 & r1 < x0 by XXREAL_1:4; then
     |. f.r1 - g .| < 1 by A4,A6; then
A8:  -1 <= f.r1 - g by ABSVALUE:5;
     now assume -1 = f.r1 - g; then
      |. f.r1 - g .| = -(-1) by ABSVALUE:def 1;
      hence contradiction by A7,A4,A6;
     end; then
     -1 < f.r1-g by A8,XXREAL_0:1; then
     -1+g < f.r1 by XREAL_1:20;
     hence thesis by A6,FUNCT_1:49;
    end; then
    f|(].x0-R,x0.[) is bounded_below by SEQ_2:def 2;
    hence ex r be Real st 0<r & f|(].x0-r,x0.[) is bounded_below
      by A3,XREAL_1:50;

    consider r be Real such that
A9:  r < x0 and
A10:  for r1 be Real st r<r1 & r1<x0 & r1 in dom f holds |.f.r1-g.| < 1
       by A2;
    set R = x0-r;

    for r1 be object st r1 in dom(f|(].x0-R,x0.[))
     holds (f|(].x0-R,x0.[)).r1 < g+1
    proof
     let r1 be object;
     assume A11: r1 in dom(f|(].x0-R,x0.[)); then
     reconsider r1 as Real;
     r1 in dom f /\ ].x0-R,x0.[ by A11,RELAT_1:61; then
A12:  r1 in dom f & r1 in ].x0-R,x0.[ by XBOOLE_0:def 4; then
     r1 < x0 & x0-R < r1 by XXREAL_1:4; then
     |. f.r1 - g .| < 1 by A10,A12; then
     f.r1-g < 1 by ABSVALUE:def 1; then
     f.r1 < g+1 by XREAL_1:19;
     hence thesis by A12,FUNCT_1:49;
    end; then
    f|(].x0-R,x0.[) is bounded_above by SEQ_2:def 1;
    hence ex r be Real st 0<r & f|(].x0-r,x0.[) is bounded_above
      by A9,XREAL_1:50;
end;

theorem Th12:
for f be PartFunc of REAL,REAL, x0 be Real st
 f is_right_divergent_to+infty_in x0 holds
  ex r be Real st 0<r & f|(].x0,x0+r.[) is bounded_below
proof
    let f be PartFunc of REAL,REAL, x0 be Real;
    assume
A1:  f is_right_divergent_to+infty_in x0;
    consider r be Real such that
A2:  x0 < r and
A3:  for r1 be Real st r1 < r & x0 < r1 & r1 in dom f holds 1 < f.r1
       by A1,LIMFUNC2:11;

    set R = r-x0;
    for r1 be object st r1 in dom(f|(].x0,x0+R.[))
     holds 1 < (f|(].x0,x0+R.[)).r1
    proof
     let r1 be object;
     assume A4: r1 in dom(f|(].x0,x0+R.[)); then
     reconsider r1 as Real;
     r1 in dom f /\ ].x0,x0+R.[ by A4,RELAT_1:61; then
A5:  r1 in dom f & r1 in ].x0,x0+R.[ by XBOOLE_0:def 4; then
     x0 < r1 & r1 < x0+R by XXREAL_1:4; then
     1 < f.r1 by A3,A5;
     hence thesis by A5,FUNCT_1:49;
    end; then
    f|(].x0,x0+R.[) is bounded_below by SEQ_2:def 2;
    hence ex r be Real st 0<r & f|(].x0,x0+r.[) is bounded_below
      by A2,XREAL_1:50;
end;

theorem Th13:
for f be PartFunc of REAL,REAL, x0 be Real st
 f is_right_divergent_to-infty_in x0 holds
  ex r be Real st 0<r & f|(].x0,x0+r.[) is bounded_above
proof
    let f be PartFunc of REAL,REAL, x0 be Real;
    assume
A1:  f is_right_divergent_to-infty_in x0;
    consider r be Real such that
A2:  x0 < r and
A3:  for r1 be Real st r1 < r & x0 < r1 & r1 in dom f holds f.r1 < 1
       by A1,LIMFUNC2:12;

    set R = r-x0;

    for r1 be object st r1 in dom(f|(].x0,x0+R.[))
     holds (f|(].x0,x0+R.[)).r1 < 1
    proof
     let r1 be object;
     assume A4: r1 in dom(f|(].x0,x0+R.[)); then
     reconsider r1 as Real;
     r1 in dom f /\ ].x0,x0+R.[ by A4,RELAT_1:61; then
A5:  r1 in dom f & r1 in ].x0,x0+R.[ by XBOOLE_0:def 4; then
     x0 < r1 & r1 < x0+R by XXREAL_1:4; then
     f.r1 < 1 by A3,A5;
     hence thesis by A5,FUNCT_1:49;
    end; then
    f|(].x0,x0+R.[) is bounded_above by SEQ_2:def 1;
    hence ex r be Real st 0<r & f|(].x0,x0+r.[) is bounded_above
      by A2,XREAL_1:50;
end;

theorem Th14:
for f be PartFunc of REAL,REAL, x0 be Real st
 f is_left_divergent_to+infty_in x0 holds
  ex r be Real st 0<r & f|(].x0-r,x0.[) is bounded_below
proof
    let f be PartFunc of REAL,REAL, x0 be Real;
    assume
A1:  f is_left_divergent_to+infty_in x0;
    consider r be Real such that
A2:  r < x0 and
A3:  for r1 be Real st r < r1 & r1 < x0 & r1 in dom f holds 1 < f.r1
       by A1,LIMFUNC2:8;

    set R = x0-r;

    for r1 be object st r1 in dom(f|(].x0-R,x0.[))
     holds 1 < (f|(].x0-R,x0.[)).r1
    proof
     let r1 be object;
     assume A4: r1 in dom(f|(].x0-R,x0.[)); then
     reconsider r1 as Real;
     r1 in dom f /\ ].x0-R,x0.[ by A4,RELAT_1:61; then
A5:  r1 in dom f & r1 in ].x0-R,x0.[ by XBOOLE_0:def 4; then
     x0-R < r1 & r1 < x0 by XXREAL_1:4; then
     1 < f.r1 by A3,A5;
     hence thesis by A5,FUNCT_1:49;
    end; then
    f|(].x0-R,x0.[) is bounded_below by SEQ_2:def 2;
    hence ex r be Real st 0<r & f|(].x0-r,x0.[) is bounded_below
      by A2,XREAL_1:50;
end;

theorem Th15:
for f be PartFunc of REAL,REAL, x0 be Real st
 f is_left_divergent_to-infty_in x0 holds
  ex r be Real st 0<r & f|(].x0-r,x0.[) is bounded_above
proof
    let f be PartFunc of REAL,REAL, x0 be Real;
    assume
A1:  f is_left_divergent_to-infty_in x0;
    consider r be Real such that
A2:  r < x0 and
A3:  for r1 be Real st r < r1 & r1 < x0 & r1 in dom f holds f.r1 < 1
       by A1,LIMFUNC2:9;

    set R = x0-r;
    for r1 be object st r1 in dom(f|(].x0-R,x0.[))
     holds (f|(].x0-R,x0.[)).r1 < 1
    proof
     let r1 be object;
     assume A4: r1 in dom(f|(].x0-R,x0.[)); then
     reconsider r1 as Real;
     r1 in dom f /\ ].x0-R,x0.[ by A4,RELAT_1:61; then
A5:  r1 in dom f & r1 in ].x0-R,x0.[ by XBOOLE_0:def 4; then
     x0-R < r1 & r1 < x0 by XXREAL_1:4; then
     f.r1 < 1 by A3,A5;
     hence thesis by A5,FUNCT_1:49;
    end; then
    f|(].x0-R,x0.[) is bounded_above by SEQ_2:def 1;
    hence ex r be Real st 0<r & f|(].x0-r,x0.[) is bounded_above
      by A2,XREAL_1:50;
end;

Lm2: for r,g,r1 be Real holds 0<g & r<=r1 implies r-g<r1 & r<r1+g
proof
  let r,g,r1 be Real;
  assume that
A1: 0<g and
A2: r<=r1;
  r-g<r1-0 by A1,A2,XREAL_1:15;
  hence r-g<r1;
  r+0<r1+g by A1,A2,XREAL_1:8;
  hence thesis;
end;

theorem Th16:
for f1,f2 be PartFunc of REAL,REAL, x0 be Real st
 f1 is_right_divergent_to-infty_in x0 &
 (for r be Real st x0<r ex g be Real st g<r & x0<g & g in dom(f1+f2)) &
 (ex r be Real st 0<r & f2|(].x0,x0+r.[) is bounded_above)
holds
  f1+f2 is_right_divergent_to-infty_in x0
proof
    let f1,f2 be PartFunc of REAL,REAL, x0 be Real;
    assume that
A1:  f1 is_right_divergent_to-infty_in x0 and
A2:  for r be Real st x0<r ex g be Real st g<r & x0<g & g in dom(f1+f2);
  given r be Real such that
A3: 0<r and
A4: f2|(].x0,x0+r.[) is bounded_above;
  now
    let seq be Real_Sequence such that
A5: seq is convergent and
A6: lim seq=x0 and
A7: rng seq c=dom(f1+f2)/\right_open_halfline(x0);
    x0<x0+r by A3,Lm2;
    then consider k be Nat such that
A8: for n be Nat st k<=n holds seq.n<x0+r by A5,A6,LIMFUNC2:2;
A9: dom(f1+f2)/\right_open_halfline(x0) c=dom(f1+f2) by XBOOLE_1:17;

A10: rng(seq^\k)c=rng seq by VALUED_0:21;
    then
A11: rng(seq^\k)c=dom(f1+f2)/\right_open_halfline(x0) by A7;

A12: rng(seq^\k)c=dom(f1+f2) by A10,A7,A9;

    dom(f1+f2)=dom f1/\dom f2 by VALUED_1:def 1;
    then
A13:dom(f1+f2)c=dom f1 & dom(f1+f2)c=dom f2 by XBOOLE_1:17;
    then
A14:rng(seq^\k)c=dom f1 & rng(seq^\k)c=dom f2 by A9,A11;
    then rng(seq^\k)c=dom f1/\dom f2 by XBOOLE_1:19;
    then
A15: f1/*(seq^\k)+f2/*(seq^\k)=(f1+f2)/*(seq^\k) by RFUNCT_2:8
      .=((f1+f2)/*seq)^\k by A7,A9,VALUED_0:27,XBOOLE_1:1;
A16: dom(f1+f2)/\ right_open_halfline(x0) c=right_open_halfline(x0) by
XBOOLE_1:17;
    then rng(seq^\k)c=right_open_halfline(x0) by A10,A7;
    then
A17: rng(seq^\k)c=dom f1/\right_open_halfline(x0) by A14,XBOOLE_1:19;
    now
      consider r1 be Real such that
A18:  for g being object st g in ].x0,x0+r.[/\dom f2 holds f2.g<=r1 by A4,
RFUNCT_1:70;
      take r2=r1+1;
      let n be Nat;
A19: n in NAT by ORDINAL1:def 12;
      seq.(n+k)<x0+r by A8,NAT_1:12;
      then
A20:  (seq^\k).n<x0+r by NAT_1:def 3;
A21:  (seq^\k).n in rng(seq^\k) by VALUED_0:28;
      then (seq^\k).n in right_open_halfline(x0) by A10,A7,A16;
      then (seq^\k).n in {g1 where g1 is Real: x0<g1} by XXREAL_1:230;
      then ex g be Real st g=(seq^\k).n & x0<g;
      then (seq^\k).n in {g2 where g2 is Real: x0<g2 & g2<x0+r} by A20;
      then (seq^\k).n in ].x0,x0+r.[ by RCOMP_1:def 2;
      then (seq^\k).n in ].x0,x0+r.[/\dom f2 by A14,A21,XBOOLE_0:def 4;
      then f2.((seq^\k).n)<r1+1 by A18,XREAL_1:39;
      hence (f2/*(seq^\k)).n<r2 by A12,A13,FUNCT_2:108,XBOOLE_1:1,A19;
    end;
    then
A22: f2/*(seq^\k) is bounded_above by SEQ_2:def 3;
    lim(seq^\k)=x0 by A5,A6,SEQ_4:20;
    then f1/*(seq^\k)+f2/*(seq^\k) is divergent_to-infty
      by A22,A1,A5,A17,LIMFUNC2:def 6,LIMFUNC1:12;
    hence (f1+f2)/*seq is divergent_to-infty by A15,LIMFUNC1:7;
  end;
  hence thesis by A2,LIMFUNC2:def 6;
end;

theorem Th17:
for f1,f2 be PartFunc of REAL,REAL, x0 be Real st
 f1 is_left_divergent_to-infty_in x0 &
 (for r be Real st r<x0 ex g be Real st r<g & g<x0 & g in dom(f1+f2)) &
 (ex r be Real st 0<r & f2|(].x0-r,x0.[) is bounded_above)
holds
  f1+f2 is_left_divergent_to-infty_in x0
proof
    let f1,f2 be PartFunc of REAL,REAL, x0 be Real;
    assume that
A1:  f1 is_left_divergent_to-infty_in x0 and
A2:  for r be Real st r<x0 ex g be Real st r<g & g<x0 & g in dom(f1+f2);
  given r be Real such that
A3: 0<r and
A4: f2|(].x0-r,x0.[) is bounded_above;
  now
    let seq be Real_Sequence such that
A5: seq is convergent and
A6: lim seq=x0 and
A7: rng seq c=dom(f1+f2) /\ left_open_halfline(x0);
    x0-r<x0 by A3,Lm2;
    then consider k be Nat such that
A8: for n be Nat st k<=n holds x0-r<seq.n by A5,A6,LIMFUNC2:1;
A9: dom(f1+f2)/\left_open_halfline(x0) c=dom(f1+f2) by XBOOLE_1:17;
A10: rng(seq^\k)c=rng seq by VALUED_0:21;
    then
A11: rng(seq^\k)c=dom(f1+f2) by A7,A9;
A12: dom(f1+f2)=dom f1/\dom f2 by VALUED_1:def 1;
    then
A13: dom(f1+f2)c=dom f2 by XBOOLE_1:17;
    then
A14: rng(seq^\k)c=dom f2 by A11;
    dom(f1+f2)c=dom f1 by A12,XBOOLE_1:17;
    then
A15: rng(seq^\k)c=dom f1 by A11;
    then rng(seq^\k)c=dom f1/\dom f2 by A14,XBOOLE_1:19;
    then
A16: f1/*(seq^\k)+f2/*(seq^\k)=(f1+f2)/*(seq^\k) by RFUNCT_2:8
      .=((f1+f2)/*seq)^\k by A7,A9,VALUED_0:27,XBOOLE_1:1;
A17: dom(f1+f2)/\ left_open_halfline(x0) c=left_open_halfline(x0) by
XBOOLE_1:17;
    then rng(seq^\k)c=left_open_halfline(x0) by A10,A7;
    then
A18: rng(seq^\k)c=dom f1/\left_open_halfline(x0) by A15,XBOOLE_1:19;

A19: now
      consider r1 be Real such that
A20:  for g being object st g in ].x0-r,x0.[/\dom f2 holds f2.g<=r1 by A4,
RFUNCT_1:70;
      take r2=r1+1;
      let n be Nat;
A21: n in NAT by ORDINAL1:def 12;
      x0-r<seq.(n+k) by A8,NAT_1:12;
      then
A22:  x0-r<(seq^\k).n by NAT_1:def 3;
A23:  (seq^\k).n in rng(seq^\k) by VALUED_0:28;
      then (seq^\k).n in left_open_halfline(x0) by A17,A10,A7;
      then (seq^\k).n in {g1 where g1 is Real: g1<x0} by XXREAL_1:229;
      then ex g be Real st g=(seq^\k).n & g<x0;
      then (seq^\k).n in {g2 where g2 is Real: x0-r<g2 & g2<x0} by A22;
      then (seq^\k).n in ].x0-r,x0.[ by RCOMP_1:def 2;
      then (seq^\k).n in ].x0-r,x0.[/\dom f2 by A14,A23,XBOOLE_0:def 4;
      then f2.((seq^\k).n)<r1+1 by A20,XREAL_1:39;
      hence (f2/*(seq^\k)).n<r2 by A11,A13,FUNCT_2:108,XBOOLE_1:1,A21;
    end;
    lim(seq^\k)=x0 by A5,A6,SEQ_4:20;
    then f1/*(seq^\k) is divergent_to-infty by A1,A5,A18,LIMFUNC2:def 3;
    then f1/*(seq^\k)+f2/*(seq^\k) is divergent_to-infty
      by A19,LIMFUNC1:12,SEQ_2:def 3;
    hence (f1+f2)/*seq is divergent_to-infty by A16,LIMFUNC1:7;
  end;
  hence thesis by A2,LIMFUNC2:def 3;
end;

begin :: Properties of Extended Riemann Integral

theorem Th18:
for f be PartFunc of REAL,REAL, a,b be Real st a < b & [' a,b '] c= dom f
 & f is_integrable_on [' a,b '] & f|[' a,b '] is bounded holds
  f is_left_ext_Riemann_integrable_on a,b
& ext_left_integral(f,a,b) = integral(f,a,b)
proof
    let f be PartFunc of REAL,REAL, a,b be Real such that
A1:  a < b and
A2:  [' a,b '] c= dom f and
A3:  f is_integrable_on [' a,b '] and
A4:  f|[' a,b '] is bounded;
    reconsider AB = ].a,b.] as non empty Subset of REAL by A1,XXREAL_1:2;
    deffunc F(Element of AB) = In(integral(f,$1,b),REAL);
    consider Intf be Function of AB, REAL such that
A5:  for x being Element of AB holds Intf.x = F(x) from FUNCT_2:sch 4;
A6:  dom Intf = AB by FUNCT_2:def 1;
    then reconsider Intf as PartFunc of REAL, REAL by RELSET_1:5;
    consider M0 be Real such that
A7:  for x being object st x in [' a,b '] /\ dom f holds |.f.x.| <= M0
       by A4,RFUNCT_1:73;
    reconsider M = M0 + 1 as Real;
A8: for x be Real st x in [' a,b '] holds |.f.x.| < M
    proof
A9:  [' a,b '] /\ dom f = [' a,b '] by A2,XBOOLE_1:28;
     let x be Real;
     assume x in [' a,b '];
     hence thesis by A7,A9,XREAL_1:39;
    end;
    a in {r where r is Real: a <= r & r <= b } by A1;
    then a in [.a,b.] by RCOMP_1:def 1;
    then a in [' a,b '] by A1,INTEGRA5:def 3;
    then |.f.a.| < M by A8;
    then
A10:0 < M by COMPLEX1:46;

A11:for g1 be Real st 0 < g1
     ex r be Real st a < r &
      for r1 be Real st r1 < r & a < r1 & r1 in dom Intf
       holds |.Intf.r1 - integral(f,a,b).| < g1
    proof
     let g1 be Real;
     assume 0 < g1;
     then consider r be Real such that
A12:  a < r and
A13:  r < b and
A14:  (r - a)*M < g1 by A1,A10,INTEGR10:2;
     reconsider r as Real;
     take r;
     thus a < r by A12;
     now
      let r1 be Real;
      assume that
A15:  r1 < r and
A16:  a < r1 and
      r1 in dom Intf;
A17:  r1 <= b by A13,A15,XXREAL_0:2;
      then reconsider rr=r1 as Element of AB by A16,XXREAL_1:2;
A18:  Intf.r1 = F(rr) by A5;
      r1 in [. a,b .] by A16,XXREAL_1:1,A17;
      then
A19:  r1 in [' a,b '] by A1,INTEGRA5:def 3;
      r - a > r1 - a by A15,XREAL_1:9;
      then
A20:  M * (r - a) > M * (r1 - a) by A10,XREAL_1:68;
A21:  [' a,b '] = [. a,b .] by A1,INTEGRA5:def 3;
      [. a,r1 .] = [' a,r1 '] by A16,INTEGRA5:def 3;
      then [' a,r1 '] c= [' a,b '] by A21,A17,XXREAL_1:34;
      then
A22:  for x be Real st x in [' a,r1 '] holds |.f.x.| <= M by A8;
      a in [' a,b '] by A1,A21,XXREAL_1:1;
      then |.integral(f,a,r1).| <= M * (r1 - a) by A1,A2,A3,A4,A16,A19,A22,
INTEGRA6:23;
      then
A23:  |.integral(f,a,r1).| < M * (r - a) by A20,XXREAL_0:2;
      |.Intf.r1 - integral(f,a,b).| = |.integral(f,a,b) - Intf.r1 .| by
COMPLEX1:60
        .= |.integral(f,a,r1) + integral(f,r1,b) - integral(f,r1,b).|
              by A1,A2
,A3,A4,A18,A19,INTEGRA6:17
        .= |.integral(f,a,r1).|;
      hence |.Intf.r1 - integral(f,a,b).| < g1 by A14,A23,XXREAL_0:2;
     end;
     hence thesis;
    end;

A24:for x be Real st x in dom Intf holds Intf.x = integral(f,x,b)
    proof let x be Real such that
A25:  x in dom Intf;
     reconsider x as Element of AB by A25,FUNCT_2:def 1;
     Intf.x = F(x) by A5;
     hence thesis;
    end;

A26: for r be Real st a < r ex g be Real st g < r & a < g & g in dom Intf
    proof
     let r be Real such that
A27:  a < r;
     per cases;
     suppose
A28:  b < r;
      reconsider g = b as Real;
      take g;
      thus thesis by A1,A6,A28,XXREAL_1:2;
     end;
     suppose
A29:   b >= r;
      reconsider g = r - (r - a)/2 as Real;
      take g;
A30:  0 < r - a by A27,XREAL_1:50; then
      -(r - a) < -(r-a)/2 by XREAL_1:24,216; then
A31:   a-r+r < -(r-a)/2+r by XREAL_1:8;

      g < r by A30,XREAL_1:44,215; then

      g <= b by A29,XXREAL_0:2;
      hence thesis by A6,A30,A31,XREAL_1:44,215,XXREAL_1:2;
     end;
    end;

    for d be Real st a < d & d <= b
     holds f is_integrable_on [' d,b '] & f|[' d,b '] is bounded
        by A2,A3,A4,INTEGRA6:18;
    hence f is_left_ext_Riemann_integrable_on a,b
      by A6,A24,A26,A11,LIMFUNC2:10,INTEGR10:def 2;
    thus ext_left_integral(f,a,b) = integral(f,a,b)
      by A1,A2,A3,A4,INTEGR10:13;
end;

theorem Th19:
for f be PartFunc of REAL,REAL, a,b be Real st a < b & ['a,b'] c= dom f
 & f is_integrable_on ['a,b'] & f|['a,b'] is bounded holds
  f is_right_ext_Riemann_integrable_on a,b
& ext_right_integral(f,a,b) = integral(f,a,b)
proof
  let f be PartFunc of REAL,REAL, a,b be Real such that
A1: a < b and
A2: [' a,b '] c= dom f and
A3: f is_integrable_on [' a,b '] and
A4: f|[' a,b '] is bounded;
  reconsider AB = [.a,b.[ as non empty Subset of REAL by A1,XXREAL_1:3;
  deffunc F(Element of AB) = In(integral(f,a,$1),REAL);
  consider Intf be Function of AB, REAL such that
A5: for x being Element of AB holds Intf.x = F(x) from FUNCT_2:sch 4;
A6: dom Intf = AB by FUNCT_2:def 1;
  then reconsider Intf as PartFunc of REAL, REAL by RELSET_1:5;
  consider M0 be Real such that
A7: for x being object st x in [' a,b '] /\ dom f holds |.f.x.| <= M0 by A4,
RFUNCT_1:73;
  reconsider M = M0 + 1 as Real;
A8: for x be Real st x in [' a,b '] holds |.f.x.| < M
  proof
A9: [' a,b '] /\ dom f = [' a,b '] by A2,XBOOLE_1:28;
    let x be Real;
    assume x in [' a,b '];
    hence thesis by A7,A9,XREAL_1:39;
  end;
  a in {r where r is Real: a <= r & r <= b } by A1;
  then a in [.a,b.] by RCOMP_1:def 1;
  then a in [' a,b '] by A1,INTEGRA5:def 3;
  then |.f.a.| < M by A8;
  then
A10: 0 < M by COMPLEX1:46;
A11: for g1 be Real st 0 < g1
   ex r be Real st r < b &
 for r1 be Real st r <
  r1 & r1 < b & r1 in dom Intf holds |.Intf.r1 - integral(f,a,b).| < g1
  proof
    let g1 be Real;
    assume 0 < g1;
    then consider r be Real such that
A12: a < r and
A13: r < b and
A14: (b - r)*M < g1 by A1,A10,INTEGR10:1;
     reconsider r as Real;
    take r;
    thus r < b by A13;
    now
      let r1 be Real;
      assume that
A15:  r < r1 and
A16:  r1 < b and
  r1 in dom Intf;
A17:  a <= r1 by A12,A15,XXREAL_0:2;
      then reconsider rr=r1 as Element of AB by A16,XXREAL_1:3;
A18:  Intf.r1 = F(rr) by A5;
      r1 in [. a,b .] by A16,XXREAL_1:1,A17;
      then
A19:  r1 in [' a,b '] by A1,INTEGRA5:def 3;
      b - r1 < b - r by A15,XREAL_1:15;
      then
A20:  M * (b - r1) < M * (b - r) by A10,XREAL_1:68;
A21:  [' a,b '] = [. a,b .] by A1,INTEGRA5:def 3;
      [. r1,b .] = [' r1,b '] by A16,INTEGRA5:def 3;
      then [' r1,b '] c= [' a,b '] by A21,A17,XXREAL_1:34;
      then
A22:  for x be Real st x in [' r1,b '] holds |.f.x.| <= M by A8;
      b in [' a,b '] by A1,A21,XXREAL_1:1;
      then |.integral(f,r1,b).| <= M * (b - r1) by A1,A2,A3,A4,A16,A19,A22,
INTEGRA6:23;
      then
A23:  |.integral(f,r1,b).| < M * (b - r) by A20,XXREAL_0:2;
      |.Intf.r1 - integral(f,a,b).| = |.integral(f,a,b) - Intf.r1 .| by
COMPLEX1:60
        .= |.integral(f,a,r1) + integral(f,r1,b) - integral(f,a,r1).|
              by A1,A2
,A3,A4,A18,A19,INTEGRA6:17
        .= |.integral(f,r1,b).|;
      hence |.Intf.r1 - integral(f,a,b).| < g1 by A14,A23,XXREAL_0:2;
    end;
    hence thesis;
  end;
A24: for x be Real st x in dom Intf holds Intf.x = integral(f,a,x)
     proof let x be Real such that
A25:     x in dom Intf;
       reconsider x as Element of AB by A25,FUNCT_2:def 1;
       Intf.x = F(x) by A5;
      hence thesis;
     end;
A26:for r be Real st r < b ex g be Real st r < g & g < b & g in dom Intf
  proof
    let r be Real such that
A27: r < b;
    per cases;
    suppose
A28:  r < a;
      reconsider g = a as Real;
      take g;
      thus thesis by A1,A6,A28,XXREAL_1:3;
    end;
    suppose
      not r < a;
      then
A29:  a - a <= r - a by XREAL_1:9;
      reconsider g = r + (b - r)/2 as Real;
      take g;
A30:  0 < b - r by A27,XREAL_1:50;
      then (b - r)/2 < b - r by XREAL_1:216;
      then
A31:  (b - r)/2 + r < b - r + r by XREAL_1:8;
      r < g by A30,XREAL_1:29,215;
      then
A32:  r - (r - a) < g - 0 by A29,XREAL_1:14;
      0 < (b - r)/2 by A30,XREAL_1:215;
      hence thesis by A6,A32,A31,XREAL_1:8,XXREAL_1:3;
    end;
  end;

  for d be Real st a <= d & d < b
   holds f is_integrable_on [' a,d '] & f|[' a,d '] is bounded
     by A2,A3,A4,INTEGRA6:18;
  hence f is_right_ext_Riemann_integrable_on a,b
    by A6,A24,A26,A11,LIMFUNC2:7,INTEGR10:def 1;
  thus ext_right_integral(f,a,b) = integral(f,a,b)
        by A1,A2,A3,A4,INTEGR10:12;
end;

theorem Th20:
for f be PartFunc of REAL,REAL, a,b,c be Real
 st a < b <= c & ].a,c.] c= dom f & f|['b,c'] is bounded
  & f is_integrable_on ['b,c'] & f is_left_ext_Riemann_integrable_on a,b
holds f is_left_ext_Riemann_integrable_on a,c
  & ext_left_integral(f,a,c) = ext_left_integral(f,a,b) + integral(f,b,c)
proof
    let f be PartFunc of REAL,REAL, a,b,c be Real;
    assume that
A1:  a < b <= c and
A2:  ].a,c.] c= dom f and
A3:  f|['b,c'] is bounded and
A4:  f is_integrable_on ['b,c'] and
A5:  f is_left_ext_Riemann_integrable_on a,b;

A6: a < c by A1,XXREAL_0:2;
A7: ['a,b'] = [.a,b.] & ['b,c'] = [.b,c.] & ['a,c'] = [.a,c.]
      by A1,XXREAL_0:2,INTEGRA5:def 3; then
    ['a,b'] c= ['a,c'] & ['b,c'] c= ].a,c.] by A1,XXREAL_1:34,39; then
A8: ['b,c'] c= dom f by A2;

A9: for e be Real st a < e <= c holds
     f is_integrable_on ['e,c'] & f|['e,c'] is bounded
    proof
     let e be Real;
     assume A10: a < e <= c;
     per cases;
     suppose A11: b <= e; then
      e in ['b,c'] by A7,A10,XXREAL_1:1;
      hence f is_integrable_on ['e,c'] by A8,A1,A3,A4,INTEGRA6:17;
      ['e,c'] = [.e,c.] by A10,INTEGRA5:def 3;
      hence f|['e,c'] is bounded by A3,A7,A11,XXREAL_1:34,RFUNCT_1:74;
     end;
     suppose A12: e < b; then
A13:   f is_integrable_on ['e,b'] & f|['e,b'] is bounded
        by A5,A10,INTEGR10:def 2;
A14:   ['e,c'] = [.e,c.] by A1,A12,XXREAL_0:2,INTEGRA5:def 3; then
      ['e,c'] c= ].a,c.] by A10,XXREAL_1:39; then
      ['e,c'] c= dom f by A2;
      hence f is_integrable_on ['e,c'] by A1,A3,A4,A12,A13,Th1;
      ['e,b'] = [.e,b.] by A12,INTEGRA5:def 3; then
      ['e,c'] = ['e,b'] \/ ['b,c'] by A1,A7,A12,A14,XXREAL_1:165;
      hence f|['e,c'] is bounded by A3,A13,RFUNCT_1:87;
     end;
    end;

    consider I be PartFunc of REAL,REAL such that
A15:  dom I = ].a,b.] and
A16:  for x be Real st x in dom I holds I.x = integral(f,x,b) and
A17:  I is_right_convergent_in a by A5,INTEGR10:def 2;

    reconsider AC = ].a,c.] as non empty Subset of REAL by A1,XXREAL_1:2;

    deffunc F(Element of AC) = In(integral(f,$1,c),REAL);
    consider Intf be Function of AC, REAL such that
A18:  for x being Element of AC holds Intf.x = F(x) from FUNCT_2:sch 4;
A19: dom Intf = AC by FUNCT_2:def 1; then
    reconsider Intf as PartFunc of REAL,REAL by RELSET_1:5;

A20: for x be Real st x in dom Intf holds Intf.x = integral(f,x,c)
    proof
     let x be Real;
     assume x in dom Intf; then
     Intf.x = In(integral(f,x,c),REAL) by A18,A19;
     hence thesis;
    end;

A21: for r be Real st a < r ex g be Real st g < r & a < g & g in dom Intf
    proof
     let r be Real;
     assume a < r; then
     consider g be Real such that
A22:  a < g < min(r,c) by A6,XXREAL_0:21,XREAL_1:5;
     take g;
A23: r >= min(r,c) & c >= min(r,c) by XXREAL_0:17;
     hence g < r & a < g by A22,XXREAL_0:2;
     a < g < c by A22,A23,XXREAL_0:2;
     hence g in dom Intf by A19,XXREAL_1:2;
    end;

    consider G be Real such that
A24: for g1 be Real st 0 < g1
      ex r be Real st a < r &
       for r1 be Real st r1<r & a<r1 & r1 in dom I holds |. I.r1 - G .| < g1
         by A17,LIMFUNC2:10;
    set G1=G+integral(f,b,c);

A25:for g1 be Real st 0 < g1
      ex r be Real st a < r &
       for r1 be Real st r1 < r & a < 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
A26:  a < R and
A27:  for r1 be Real st r1<R & a<r1 & r1 in dom I holds |. I.r1 - G .| < g1
          by A24;
      set R1=min(R,b);
      take R1;

      thus a < R1 by A26,A1,XXREAL_0:21;
      thus for r1 be Real st r1 < R1 & a < r1 & r1 in dom Intf
       holds |. Intf.r1 - G1 .| < g1
      proof
       let r1 be Real;
       assume that
A28:    r1 < R1 & a < r1 and
A29:    r1 in dom Intf;

       R1 <= R by XXREAL_0:17; then
A30:    r1 < R by A28,XXREAL_0:2;

       r1 <= c by A19,A29,XXREAL_1:2; then
       ['r1,c'] = [.r1,c.] by INTEGRA5:def 3; then
       ['r1,c'] c= ].a,c.] by A28,XXREAL_1:39; then
A31:    ['r1,c'] c= dom f by A2;

       R1 <= b by XXREAL_0:17; then
A32:  r1 <= b by A28,XXREAL_0:2; then
A33:  r1 in dom I by A15,A28,XXREAL_1:2;

A34:    f is_integrable_on ['r1,b']
     & f|['r1,b'] is bounded by A5,A28,A32,INTEGR10:def 2;

       Intf.r1 = integral(f,r1,c) by A20,A29; then
       Intf.r1 - G1 = integral(f,r1,c) - integral(f,b,c) - G; then
       Intf.r1 - G1 = integral(f,r1,b) + integral(f,b,c) - integral(f,b,c)
         - G by A31,A1,A3,A4,A32,A34,Th1; then
       Intf.r1 - G1 = I.r1 - G by A16,A28,A32,A15,XXREAL_1:2;
      hence |. Intf.r1 - G1 .| < g1 by A30,A27,A28,A33;
     end;
    end;
    hence
A35: f is_left_ext_Riemann_integrable_on a,c
       by A9,A19,A20,A21,LIMFUNC2:10,INTEGR10:def 2;

A36: Intf is_right_convergent_in a by A21,A25,LIMFUNC2:10; then
A37: ext_left_integral(f,a,c) = lim_right(Intf,a) by A19,A20,A35
,INTEGR10:def 4;

A38:ext_left_integral(f,a,b) = lim_right(I,a)
      by A5,A15,A16,A17,INTEGR10:def 4;

    for g1 be Real st 0 < g1 ex r be Real st a < r & for r1 be Real st r1 < r
     & a < r1 & r1 in dom Intf holds
      |. Intf.r1 - (ext_left_integral(f,a,b) + integral(f,b,c)) .| < g1
    proof
     let g1 be Real;
     assume A39: 0 < g1;

     consider r be Real such that
A40:   a < r & for r1 be Real st r1 < r & a < r1 & r1 in dom I holds
       |. I.r1 - ext_left_integral(f,a,b) .| < g1 by A39,A38,A17,LIMFUNC2:42;

     set R = min(b,r);
     for r1 be Real st r1 < R  & a < r1 & r1 in dom Intf holds
      |. Intf.r1 - (ext_left_integral(f,a,b) + integral(f,b,c)) .| < g1
     proof
      let r1 be Real;
      assume
A41:    r1 < R & a < r1 & r1 in dom Intf; then
      r1 <= c & a < c by A1,A19,XXREAL_0:2,XXREAL_1:2; then
A42:   [.r1,c.] = ['r1,c'] & [.a,c.] = ['a,c'] by INTEGRA5:def 3;
      [.r1,c.] c= ].a,c.] by A41,XXREAL_1:39; then
A43:   ['r1,c'] c= dom f by A42,A2;
      R <= b & R <= r by XXREAL_0:17; then
A44:   r1 < b & r1 < r by A41,XXREAL_0:2; then
A45:   r1 in dom I by A41,A15,XXREAL_1:2;
      f is_integrable_on ['r1,b'] & f|['r1,b'] is bounded
        by A41,A44,A5,INTEGR10:def 2; then
      integral(f,r1,c) = integral(f,r1,b) + integral(f,b,c)
        by A1,A43,A3,A4,A44,Th1; then
      Intf.r1 = integral(f,b,c) + integral(f,r1,b) by A41,A20; then
      Intf.r1 - (integral(f,b,c) + ext_left_integral(f,a,b))
       = integral(f,r1,b) - ext_left_integral(f,a,b)
      .= I.r1 - ext_left_integral(f,a,b) by A44,A16,A41,A15,XXREAL_1:2;
      hence
      |. Intf.r1 - (ext_left_integral(f,a,b) + integral(f,b,c)) .| < g1
        by A40,A41,A45,A44;
     end;
     hence thesis by A1,A40,XXREAL_0:21;
    end;
    hence ext_left_integral(f,a,c) = ext_left_integral(f,a,b) + integral(f,b,c)
     by A36,A37,LIMFUNC2:42;
end;

theorem Th21:
for f be PartFunc of REAL,REAL, a,b,c be Real
 st a <= b < c & [.a,c.[ c= dom f & f|['a,b'] is bounded
  & f is_integrable_on ['a,b'] & f is_right_ext_Riemann_integrable_on b,c
holds f is_right_ext_Riemann_integrable_on a,c
  & ext_right_integral(f,a,c) = integral(f,a,b) + ext_right_integral(f,b,c)
proof
    let f be PartFunc of REAL,REAL, a,b,c be Real;
    assume that
A1:  a <= b < c and
A2:  [.a,c.[ c= dom f and
A3:  f|['a,b'] is bounded and
A4:  f is_integrable_on ['a,b'] and
A5:  f is_right_ext_Riemann_integrable_on b,c;

A6: a < c by A1,XXREAL_0:2;
A7: ['a,b'] = [.a,b.] & ['b,c'] = [.b,c.] & ['a,c'] = [.a,c.]
      by A1,XXREAL_0:2,INTEGRA5:def 3; then
    ['a,b'] c= [.a,c.[ & ['b,c'] c= ['a,c'] by A1,XXREAL_1:34,43; then
A8: ['a,b'] c= dom f by A2;

A9: for e be Real st a <= e < c holds
     f is_integrable_on ['a,e'] & f|['a,e'] is bounded
    proof
     let e be Real;
     assume A10: a <= e < c;
     per cases;
     suppose A11: e <= b; then
      e in ['a,b'] by A7,A10,XXREAL_1:1;
      hence f is_integrable_on ['a,e'] by A8,A1,A3,A4,INTEGRA6:17;
      ['a,e'] = [.a,e.] by A10,INTEGRA5:def 3;
      hence f|['a,e'] is bounded by A3,A7,A11,XXREAL_1:34,RFUNCT_1:74;
     end;
     suppose A12: b < e; then
A13:   f is_integrable_on ['b,e'] & f|['b,e'] is bounded
        by A5,A10,INTEGR10:def 1;
A14:   ['a,e'] = [.a,e.] by A1,A12,XXREAL_0:2,INTEGRA5:def 3; then
      ['a,e'] c= [.a,c.[ by A10,XXREAL_1:43; then
      ['a,e'] c= dom f by A2;
      hence f is_integrable_on ['a,e'] by A1,A3,A4,A12,A13,Th1;
      ['b,e'] = [.b,e.] by A12,INTEGRA5:def 3; then
      ['a,e'] = ['a,b'] \/ ['b,e'] by A1,A7,A12,A14,XXREAL_1:165;
      hence f|['a,e'] is bounded by A3,A13,RFUNCT_1:87;
     end;
    end;

    consider I be PartFunc of REAL,REAL such that
A15:  dom I = [.b,c.[ and
A16:  for x be Real st x in dom I holds I.x = integral(f,b,x) and
A17:  I is_left_convergent_in c by A5,INTEGR10:def 1;

    reconsider AC = [.a,c.[ as non empty Subset of REAL by A1,XXREAL_1:3;

    deffunc F(Element of AC) = In(integral(f,a,$1),REAL);
    consider Intf be Function of AC, REAL such that
A18:  for x being Element of AC holds Intf.x = F(x) from FUNCT_2:sch 4;
A19: dom Intf = AC by FUNCT_2:def 1; then
    reconsider Intf as PartFunc of REAL,REAL by RELSET_1:5;
A20: for x be Real st x in dom Intf holds Intf.x = integral(f,a,x)
    proof
     let x be Real;
     assume x in dom Intf; then
     Intf.x = In(integral(f,a,x),REAL) by A18,A19;
     hence thesis;
    end;

A21: for r be Real st r < c ex g be Real st r < g < c & g in dom Intf
    proof
     let r be Real;
     assume r < c; then
     consider g be Real such that
A22:  max(r,a) < g < c by A6,XXREAL_0:29,XREAL_1:5;
     take g;
A23: r <= max(r,a) & a <= max(r,a) by XXREAL_0:25;
     hence r < g < c by A22,XXREAL_0:2;
     a < g < c by A22,A23,XXREAL_0:2;
     hence g in dom Intf by A19,XXREAL_1:3;
    end;

    consider G be Real such that
A24: for g1 be Real st 0 < g1
      ex r be Real st r < c &
       for r1 be Real st r < r1 < c & r1 in dom I holds |. I.r1 - G .| < g1
          by A17,LIMFUNC2:7;
    set G1=G+integral(f,a,b);

A25:for g1 be Real st 0 < g1
     ex r be Real st r < c &
      for r1 be Real st r < r1 < c & r1 in dom Intf
       holds |. Intf.r1 - G1 .| < g1
    proof
     let g1 be Real;
     assume 0 < g1; then
     consider R be Real such that
A26:  R < c and
A27:  for r1 be Real st R < r1 < c & r1 in dom I holds |. I.r1 - G .| < g1
        by A24;
     set R1=max(R,b);
     take R1;

     thus R1 < c by A26,A1,XXREAL_0:29;
     thus for r1 be Real st R1 < r1 < c & r1 in dom Intf
        holds |. Intf.r1 - G1 .| < g1
     proof
      let r1 be Real;
      assume that
A28:   R1 < r1 < c and
A29:   r1 in dom Intf;

      R <= R1 & b <= R1 by XXREAL_0:25; then
A30:   R < r1 & b < r1 by A28,XXREAL_0:2; then
A31:   f is_integrable_on ['b,r1'] & f|['b,r1'] is bounded
         by A5,A28,INTEGR10:def 1;

      a <= r1 by A19,A29,XXREAL_1:3; then
      ['a,r1'] = [.a,r1.] by INTEGRA5:def 3; then
      ['a,r1'] c= [.a,c.[ by A28,XXREAL_1:43; then
A32:   ['a,r1'] c= dom f by A2;

A33: r1 in dom I by A15,A28,A30,XXREAL_1:3;

      Intf.r1 = integral(f,a,r1) by A20,A29; then
      Intf.r1 - G1 = integral(f,a,r1) - integral(f,a,b) - G; then
      Intf.r1 - G1 = integral(f,a,b) + integral(f,b,r1) - integral(f,a,b)
          - G by A32,A1,A3,A4,A30,A31,Th1; then
      Intf.r1 - G1 = I.r1 - G by A16,A28,A30,A15,XXREAL_1:3;
      hence |. Intf.r1 - G1 .| < g1 by A30,A27,A28,A33;
     end;
    end;
    hence
A34: f is_right_ext_Riemann_integrable_on a,c
      by A9,A19,A20,A21,LIMFUNC2:7,INTEGR10:def 1;

A35:Intf is_left_convergent_in c by A25,A21,LIMFUNC2:7; then
A36: ext_right_integral(f,a,c) = lim_left(Intf,c) by A19,A20,A34
,INTEGR10:def 3;

A37:ext_right_integral(f,b,c) = lim_left(I,c)
      by A5,A15,A16,A17,INTEGR10:def 3;

    for g1 be Real st 0 < g1 ex r be Real st r < c & for r1 be Real st r < r1
     & r1 < c & r1 in dom Intf holds
      |. Intf.r1 - (integral(f,a,b) + ext_right_integral(f,b,c)) .| < g1
    proof
     let g1 be Real;
     assume A38: 0 < g1;

     consider r be Real such that
A39:   r < c & for r1 be Real st r < r1 & r1 < c & r1 in dom I holds
      |. I.r1 - ext_right_integral(f,b,c) .| < g1 by A38,A37,A17,LIMFUNC2:41;

     set R = max(b,r);
     for r1 be Real st R < r1 & r1 < c & r1 in dom Intf holds
      |. Intf.r1 - (integral(f,a,b) + ext_right_integral(f,b,c)) .| < g1
     proof
      let r1 be Real;
      assume
A40:    R < r1 & r1 < c & r1 in dom Intf; then
      a <= r1 & a < c by A1,A19,XXREAL_0:2,XXREAL_1:3; then
A41:   [.a,r1.] = ['a,r1'] & [.a,c.] = ['a,c'] by INTEGRA5:def 3;
      [.a,r1.] c= [.a,c.[ by A40,XXREAL_1:43; then
A42:   ['a,r1'] c= dom f by A41,A2;
      b <= R & r <= R by XXREAL_0:25; then
A43:   b < r1 & r < r1 by A40,XXREAL_0:2; then
A44:   r1 in dom I by A40,A15,XXREAL_1:3;
      f is_integrable_on ['b,r1'] & f|['b,r1'] is bounded
        by A40,A43,A5,INTEGR10:def 1; then
      integral(f,a,r1) = integral(f,a,b) + integral(f,b,r1)
        by A1,A42,A3,A4,A43,Th1; then
      Intf.r1 = integral(f,a,b) + integral(f,b,r1) by A40,A20; then
      Intf.r1 - (integral(f,a,b) + ext_right_integral(f,b,c))
       = integral(f,b,r1) - ext_right_integral(f,b,c)
      .= I.r1 - ext_right_integral(f,b,c) by A43,A16,A40,A15,XXREAL_1:3;
      hence
       |. Intf.r1 - (integral(f,a,b) + ext_right_integral(f,b,c)) .| < g1
         by A39,A40,A44,A43;
     end;
     hence thesis by A1,A39,XXREAL_0:29;
    end;
    hence
    ext_right_integral(f,a,c) = integral(f,a,b) + ext_right_integral(f,b,c)
      by A35,A36,LIMFUNC2:41;
end;

Lm3:
  for f be PartFunc of REAL,REAL, a,b be Real st a < b & [' a,b '] c=
  dom f & f is_integrable_on [' a,b '] & f|[' a,b '] is bounded holds
  f is_left_ext_Riemann_integrable_on a,b &
  ext_left_integral(f,a,b) = integral(f,a,b)
proof
  let f be PartFunc of REAL,REAL, a,b be Real such that
A1: a < b and
A2: [' a,b '] c= dom f and
A3: f is_integrable_on [' a,b '] and
A4: f|[' a,b '] is bounded;
  reconsider AB = ].a,b.] as non empty Subset of REAL by A1,XXREAL_1:2;
  deffunc F(Element of AB) = In(integral(f,$1,b),REAL);
  consider Intf be Function of AB, REAL such that
A5: for x being Element of AB holds Intf.x = F(x) from FUNCT_2:sch 4;
A6: dom Intf = AB by FUNCT_2:def 1;
  then reconsider Intf as PartFunc of REAL, REAL by RELSET_1:5;
  consider M0 be Real such that
A7: for x being object st x in [' a,b '] /\ dom f holds |.f.x.| <= M0 by A4,
RFUNCT_1:73;
  reconsider M = M0 + 1 as Real;
A8: for x be Real st x in [' a,b '] holds |.f.x.| < M
  proof
A9: [' a,b '] /\ dom f = [' a,b '] by A2,XBOOLE_1:28;
    let x be Real;
    assume x in [' a,b '];
    hence thesis by A7,A9,XREAL_1:39;
  end;
  a in {r where r is Real: a <= r & r <= b } by A1;
  then a in [.a,b.] by RCOMP_1:def 1;
  then a in [' a,b '] by A1,INTEGRA5:def 3;
  then |.f.a.| < M by A8;
  then
A10: 0 < M by COMPLEX1:46;
A11: for g1 be Real st 0 < g1 ex r be Real st a < r &
  for r1 be Real st r1 <
  r & a < r1 & r1 in dom Intf holds |.Intf.r1 - integral(f,a,b).| < g1
  proof
    let g1 be Real;
    assume 0 < g1;
    then consider r be Real such that
A12: a < r and
A13: r < b and
A14: (r - a)*M < g1 by A1,A10,INTEGR10:2;
    take r;
    thus a < r by A12;
    now
      let r1 be Real;
      assume that
A15:  a < r1 and
A16:  r1 < r and
  r1 in dom Intf;
      r1 < b by A16,A13,XXREAL_0:2;
      then reconsider rr=r1 as Element of AB by A15,XXREAL_1:2;
A17:  Intf.r1 = F(rr) by A5;
      r1 - a < r - a by A16,XREAL_1:14;
      then
A18:  M * (r1 - a) < M * (r - a) by A10,XREAL_1:68;
A19:  [' a,b '] = [. a,b .] by A1,INTEGRA5:def 3;
A20:  r1 <= b by A13,A16,XXREAL_0:2;
      then
A21:  r1 in [' a,b '] by A15,A19,XXREAL_1:1;
      [. a,r1 .] = [' a,r1 '] by A15,INTEGRA5:def 3;
      then [' a,r1 '] c= [' a,b '] by A19,A20,XXREAL_1:34;
      then
A22:  for x be Real st x in [' a,r1 '] holds |.f.x.| <= M by A8;
      a in [' a,b '] by A1,A19,XXREAL_1:1;
      then |.integral(f,a,r1).| <= M * (r1 - a) by A1,A2,A3,A4,A15,A21,A22,
INTEGRA6:23;
      then
A23:  |.integral(f,a,r1).| < M * (r - a) by A18,XXREAL_0:2;
      |.Intf.r1 - integral(f,a,b).| = |.integral(f,a,b) - Intf.r1.| by
COMPLEX1:60
        .= |.integral(f,a,r1) + integral(f,r1,b) - integral(f,r1,b).|
              by A1,A2
,A3,A4,A17,A21,INTEGRA6:17
        .= |.integral(f,a,r1).|;
      hence |.Intf.r1 - integral(f,a,b).| < g1 by A14,A23,XXREAL_0:2;
    end;
    hence thesis;
  end;
A24: for x be Real st x in dom Intf holds Intf.x = integral(f,x,b)
     proof let x be Real such that
A25:     x in dom Intf;
       reconsider x as Element of AB by A25,FUNCT_2:def 1;
       Intf.x = F(x) by A5;
      hence thesis;
     end;
A26:for r be Real st a < r ex g be Real st g < r & a < g & g in dom Intf
  proof
    let r be Real such that
A27: a < r;
    per cases;
    suppose
A28:  b < r;
      reconsider g = b as Real;
      take g;
      g in ].a,b.] by A1,XXREAL_1:2;
      hence thesis by A1,A28,FUNCT_2:def 1;
    end;
    suppose
A29:  not b < r;
      reconsider g = a + (r - a)/2 as Real;
      take g;
A30:  0 < r - a by A27,XREAL_1:50;
      then
A31:  a < g by XREAL_1:29,215;
      (r - a)/2 < r - a by A30,XREAL_1:216;
      then
A32:  (r - a)/2 + a < r - a + a by XREAL_1:8;
      then g < b by A29,XXREAL_0:2;
      hence thesis by A6,A31,A32,XXREAL_1:2;
    end;
  end;
  then
A33: Intf is_right_convergent_in a by A11,LIMFUNC2:10;
  then
A34: integral(f,a,b) = lim_right(Intf,a) by A11,LIMFUNC2:42;
  for d be Real st a < d & d <= b
     holds f is_integrable_on [' d,b '] & f|
  [' d,b '] is bounded by A2,A3,A4,INTEGRA6:18;
  hence f is_left_ext_Riemann_integrable_on a,b
    by A6,A24,A26,A11,LIMFUNC2:10,INTEGR10:def 2;
  hence thesis by A6,A24,A33,A34,INTEGR10:def 4;
end;

Lm4:
for f be PartFunc of REAL,REAL, a,b be Real
 st ].a,b.] c= dom f & f is_left_ext_Riemann_integrable_on a,b holds
  for c be Real st a <= c < b holds f is_left_ext_Riemann_integrable_on c,b
proof
    let f be PartFunc of REAL,REAL, a,b be Real;
    assume that
A1:  ].a,b.] c= dom f and
A2:  f is_left_ext_Riemann_integrable_on a,b;
    let c be Real;
    assume
A3:  a <= c < b; then
    per cases by XXREAL_0:1;
    suppose a = c;
     hence thesis by A2;
    end;
    suppose
A4:  a < c; then
     [.c,b.] c= ].a,b.] by XXREAL_1:39; then
     ['c,b'] c= ].a,b.] by A3,INTEGRA5:def 3; then
A5:  ['c,b'] c= dom f by A1;
     f is_integrable_on ['c,b'] & f|['c,b'] is bounded
       by A2,A3,A4,INTEGR10:def 2;
     hence thesis by A3,A5,Lm3;
    end;
end;

theorem Th22:
for f be PartFunc of REAL,REAL, a,b be Real
 st ].a,b.] c= dom f & f is_left_ext_Riemann_integrable_on a,b holds
  for d be Real st a < d <= b holds
    f is_left_ext_Riemann_integrable_on a,d
  & ext_left_integral(f,a,b) = ext_left_integral(f,a,d) + integral(f,d,b)
proof
    let f be PartFunc of REAL,REAL, a,b be Real;
    assume that
A1:  ].a,b.] c= dom f and
A2:  f is_left_ext_Riemann_integrable_on a,b;

    hereby let d be Real;
     assume that
A3:   a < d and
A4:   d <= b;

A5:  for c be Real st a < c & c <= d holds
       f is_integrable_on ['c,d'] & f|['c,d'] is bounded
     proof
      let c be Real;
      assume A6: a < c <= d; then
      a < c <= b by A4,XXREAL_0:2; then
A7:   f is_integrable_on ['c,b'] & f|['c,b'] is bounded by A2,INTEGR10:def 2;

A8:   ['c,d'] = [.c,d.] & ['c,b'] = [.c,b.]
        by A6,A4,XXREAL_0:2,INTEGRA5:def 3; then
      ['c,b'] c= ].a,b.] by A6,XXREAL_1:39; then
      ['c,b'] c= dom f by A1;
      hence f is_integrable_on ['c,d'] by A4,A6,A7,INTEGRA6:18;
      thus f|['c,d'] is bounded by A7,A8,A4,XXREAL_1:34,RFUNCT_1:74;
     end;

     consider I be PartFunc of REAL,REAL such that
A9:   dom I = ].a,b.] and
A10:   for x be Real st x in dom I holds I.x = integral(f,x,b) and
A11:   I is_right_convergent_in a by A2,INTEGR10:def 2;

     reconsider AB = ].a,d.] as non empty Subset of REAL by A3,XXREAL_1:2;

     deffunc F(Element of AB) = In(integral(f,$1,d),REAL);
     consider Intf be Function of AB, REAL such that
A12:   for x being Element of AB holds Intf.x = F(x) from FUNCT_2:sch 4;
A13:  dom Intf = AB by FUNCT_2:def 1; then
     reconsider Intf as PartFunc of REAL,REAL by RELSET_1:5;

A14:  for x be Real st x in dom Intf holds Intf.x = integral(f,x,d)
     proof
      let x be Real;
      assume x in dom Intf; then
      Intf.x = In(integral(f,x,d),REAL) by A12,A13;
      hence thesis;
     end;

A15:  for r be Real st a < r ex g be Real st g<r & a<g & g in dom Intf
     proof
      let r be Real;
      assume a < r; then
      consider g be Real such that
A16:   a < g < min(r,d) by A3,XXREAL_0:21,XREAL_1:5;
      take g;
A17:  min(r,d) <= r & min(r,d) <= d by XXREAL_0:17;
      hence g < r & a < g by A16,XXREAL_0:2;
      a < g < d by A16,A17,XXREAL_0:2;
      hence g in dom Intf by A13,XXREAL_1:2;
     end;

     consider G be Real such that
A18:  for g1 be Real st 0 < g1
       ex r be Real st a < r &
        for r1 be Real st r1<r & a<r1 & r1 in dom I
         holds |. I.r1 - G .| < g1 by A11,LIMFUNC2:10;

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

     for g1 be Real st 0 < g1
      ex r be Real st a<r &
       for r1 be Real st r1<r & a<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:   a < R and
A20:   for r1 be Real st r1 < R & a<r1 & r1 in dom I
        holds |. I.r1 - G .| < g1 by A18;
      take R;

      thus a < R by A19;
      thus for r1 be Real st r1 < R & a < r1 & r1 in dom Intf
         holds |. Intf.r1 - G1 .| < g1
      proof
       let r1 be Real;
       assume that
A21:    r1 < R & a < r1 and
A22:    r1 in dom Intf;

A23:  r1 <= d by A13,A22,XXREAL_1:2; then

A24:  r1 <= b by A4,XXREAL_0:2; then
A25:  r1 in dom I by A9,A21,XXREAL_1:2;

A26:   f is_integrable_on ['r1,b'] by A21,A24,A2,INTEGR10:def 2;
A27:   f|['r1,b'] is bounded by A21,A24,A2,INTEGR10:def 2;

A28:  ['r1,b'] = [.r1,b.] by A23,A4,XXREAL_0:2,INTEGRA5:def 3; then
       ['r1,b'] c= ].a,b.] by A21,XXREAL_1:39; then
A29:   ['r1,b'] c= dom f by A1;
A30:  d in ['r1,b'] by A4,A28,A23,XXREAL_1:1;
A31:  b in ['r1,b'] by A24,A28,XXREAL_1:1;

       Intf.r1 = integral(f,r1,d) by A14,A22; then
       Intf.r1 - G1 = integral(f,r1,d) + integral(f,d,b) - G; then
       Intf.r1 - G1 = integral(f,r1,b) - G
          by A26,A27,A29,A30,A31,A23,A4,XXREAL_0:2,INTEGRA6:20; then
       Intf.r1 - G1 = I.r1 - G by A21,A10,A24,A9,XXREAL_1:2;
       hence |. Intf.r1 - G1 .| < g1 by A20,A21,A25;
      end;
     end;
     hence
A32:   f is_left_ext_Riemann_integrable_on a,d
       by A5,A13,A14,A15,LIMFUNC2:10,INTEGR10:def 2;
     f is_integrable_on ['d,b'] & f|['d,b'] is bounded
       by A3,A4,A2,INTEGR10:def 2;
     hence ext_left_integral(f,a,b)
       = ext_left_integral(f,a,d) + integral(f,d,b) by A3,A4,A1,A32,Th20;
    end;
end;

theorem
for f be PartFunc of REAL,REAL, a,b be Real
 st ].a,b.] c= dom f & f is_left_ext_Riemann_integrable_on a,b holds
  for c,d be Real st a <= c & c < d & d <= b holds
    f is_left_ext_Riemann_integrable_on c,d
  & (a < c implies ext_left_integral(f,c,d) = integral(f,c,d))
proof
    let f be PartFunc of REAL,REAL, a,b be Real;
    assume A1: ].a,b.] c= dom f & f is_left_ext_Riemann_integrable_on a,b;
    hereby let c,d be Real;
     assume that
A2:   a <= c and
A3:   c < d and
A4:   d <= b;
     c < b by A3,A4,XXREAL_0:2; then

A5:  f is_left_ext_Riemann_integrable_on c,b by A1,A2,Lm4;
     ].c,b.] c= ].a,b.] by A2,XXREAL_1:42; then
     ].c,b.] c= dom f by A1;
     hence f is_left_ext_Riemann_integrable_on c,d by A3,A4,A5,Th22;
     thus a < c implies ext_left_integral(f,c,d) = integral(f,c,d)
     proof
      assume
A6:    a < c;
       a < d by A2,A3,XXREAL_0:2; then
       f is_left_ext_Riemann_integrable_on a,d by A1,A4,Th22; then
A7:    f is_integrable_on ['c,d'] & f|['c,d'] is bounded
         by A3,A6,INTEGR10:def 2;
       ['c,d'] = [.c,d.] by A3,INTEGRA5:def 3; then
       ['c,d'] c= ].a,b.] by A4,A6,XXREAL_1:39; then
       ['c,d'] c= dom f by A1;
       hence ext_left_integral(f,c,d) = integral(f,c,d)
         by A3,A7,INTEGR10:13;
     end;
    end;
end;

theorem
for f be PartFunc of REAL,REAL, a,b be Real
 st ].a,b.] c= dom f & f is_left_ext_Riemann_integrable_on a,b holds
  for c,d be Real st a < c & c < d & d <= b holds
    f is_right_ext_Riemann_integrable_on c,d
  & ext_right_integral(f,c,d) = integral(f,c,d)
proof
   let f be PartFunc of REAL,REAL, a,b be Real;
   assume that
A1: ].a,b.] c= dom f and
A2: f is_left_ext_Riemann_integrable_on a,b;

   hereby let c,d be Real;
    assume that
A3:  a < c and
A4:  c < d <= b;

A5: c < b by A4,XXREAL_0:2; then
    ['c,b'] = [.c,b.] & ['a,b'] = [.a,b.] & ['c,d'] = [.c,d.]
      by A3,A4,XXREAL_0:2,INTEGRA5:def 3; then
    ['c,b'] c= ].a,b.] & ['c,d'] c= ].a,b.] by A4,A3,XXREAL_1:39; then
A6: ['c,b'] c= dom f & ['c,d'] c= dom f by A1;

    f is_integrable_on [' c,b '] & f|[' c,b '] is bounded
      by A3,A5,A2,INTEGR10:def 2; then
A7: f is_integrable_on [' c,d '] & f|[' c,d '] is bounded by A4,A6,INTEGRA6:18;
    hence f is_right_ext_Riemann_integrable_on c,d by A4,A6,Th19;
    thus ext_right_integral(f,c,d) = integral(f,c,d) by A4,A6,A7,Th19;
   end;
end;

Lm5:
  for f be PartFunc of REAL,REAL, a,b be Real st a < b & [' a,b '] c=
  dom f & f is_integrable_on [' a,b '] & f|[' a,b '] is bounded holds
  f is_right_ext_Riemann_integrable_on a,b &
  ext_right_integral(f,a,b) = integral(f,a,b)
proof
  let f be PartFunc of REAL,REAL, a,b be Real such that
A1: a < b and
A2: [' a,b '] c= dom f and
A3: f is_integrable_on [' a,b '] and
A4: f|[' a,b '] is bounded;
  reconsider AB = [.a,b.[ as non empty Subset of REAL by A1,XXREAL_1:3;
  deffunc F(Element of AB) = In(integral(f,a,$1),REAL);
  consider Intf be Function of AB, REAL such that
A5: for x being Element of AB holds Intf.x = F(x) from FUNCT_2:sch 4;
A6: dom Intf = AB by FUNCT_2:def 1;
  then reconsider Intf as PartFunc of REAL, REAL by RELSET_1:5;
  consider M0 be Real such that
A7: for x being object st x in [' a,b '] /\ dom f holds |.f.x.| <= M0 by A4,
RFUNCT_1:73;
  reconsider M = M0 + 1 as Real;
A8: for x be Real st x in [' a,b '] holds |.f.x.| < M
  proof
A9: [' a,b '] /\ dom f = [' a,b '] by A2,XBOOLE_1:28;
    let x be Real;
    assume x in [' a,b '];
    hence thesis by A7,A9,XREAL_1:39;
  end;
  a in {r where r is Real: a <= r & r <= b } by A1;
  then a in [.a,b.] by RCOMP_1:def 1;
  then a in [' a,b '] by A1,INTEGRA5:def 3;
  then |.f.a.| < M by A8;
  then
A10: 0 < M by COMPLEX1:46;
A11: for g1 be Real st 0 < g1
   ex r be Real st r < b &
 for r1 be Real st r <
  r1 & r1 < b & r1 in dom Intf holds |.Intf.r1 - integral(f,a,b).| < g1
  proof
    let g1 be Real;
    assume 0 < g1;
    then consider r be Real such that
A12: a < r and
A13: r < b and
A14: (b - r)*M < g1 by A1,A10,INTEGR10:1;
     reconsider r as Real;
    take r;
    thus r < b by A13;
    now
      let r1 be Real;
      assume that
A15:  r < r1 and
A16:  r1 < b and
  r1 in dom Intf;
A17:  a <= r1 by A12,A15,XXREAL_0:2;
      then reconsider rr=r1 as Element of AB by A16,XXREAL_1:3;
A18:  Intf.r1 = F(rr) by A5;
      r1 in [. a,b .] by A16,XXREAL_1:1,A17;
      then
A19:  r1 in [' a,b '] by A1,INTEGRA5:def 3;
      b - r1 < b - r by A15,XREAL_1:15;
      then
A20:  M * (b - r1) < M * (b - r) by A10,XREAL_1:68;
A21:  [' a,b '] = [. a,b .] by A1,INTEGRA5:def 3;
      [. r1,b .] = [' r1,b '] by A16,INTEGRA5:def 3;
      then [' r1,b '] c= [' a,b '] by A21,A17,XXREAL_1:34;
      then
A22:  for x be Real st x in [' r1,b '] holds |.f.x.| <= M by A8;
      b in [' a,b '] by A1,A21,XXREAL_1:1;
      then |.integral(f,r1,b).| <= M * (b - r1) by A1,A2,A3,A4,A16,A19,A22,
INTEGRA6:23;
      then
A23:  |.integral(f,r1,b).| < M * (b - r) by A20,XXREAL_0:2;
      |.Intf.r1 - integral(f,a,b).| = |.integral(f,a,b) - Intf.r1 .| by
COMPLEX1:60
        .= |.integral(f,a,r1) + integral(f,r1,b) - integral(f,a,r1).|
              by A1,A2
,A3,A4,A18,A19,INTEGRA6:17
        .= |.integral(f,r1,b).|;
      hence |.Intf.r1 - integral(f,a,b).| < g1 by A14,A23,XXREAL_0:2;
    end;
    hence thesis;
  end;
A24: for x be Real st x in dom Intf holds Intf.x = integral(f,a,x)
     proof let x be Real such that
A25:     x in dom Intf;
       reconsider x as Element of AB by A25,FUNCT_2:def 1;
       Intf.x = F(x) by A5;
      hence thesis;
     end;
A26:for r be Real st r < b ex g be Real st r < g & g < b & g in dom Intf
  proof
    let r be Real such that
A27: r < b;
    per cases;
    suppose
A28:  r < a;
      reconsider g = a as Real;
      take g;
      thus thesis by A1,A6,A28,XXREAL_1:3;
    end;
    suppose
      not r < a; then
A29:  a - a <= r - a by XREAL_1:9;
      reconsider g = r + (b - r)/2 as Real;
      take g;
A30:  0 < b - r by A27,XREAL_1:50;
      then (b - r)/2 < b - r by XREAL_1:216;
      then
A31:  (b - r)/2 + r < b - r + r by XREAL_1:8;
      r < g by A30,XREAL_1:29,215;
      then
A32:  r - (r - a) < g - 0 by A29,XREAL_1:14;
      0 < (b - r)/2 by A30,XREAL_1:215;
      hence thesis by A6,A32,A31,XREAL_1:8,XXREAL_1:3;
    end;
  end;
  then
A33: Intf is_left_convergent_in b by A11,LIMFUNC2:7;
  then
A34: integral(f,a,b) = lim_left(Intf,b) by A11,LIMFUNC2:41;
  for d be Real st a <= d & d < b
   holds f is_integrable_on [' a,d '] & f|
  [' a,d '] is bounded by A2,A3,A4,INTEGRA6:18;
  hence f is_right_ext_Riemann_integrable_on a,b
    by A6,A24,A26,A11,LIMFUNC2:7,INTEGR10:def 1;
  hence thesis by A6,A24,A33,A34,INTEGR10:def 3;
end;

Lm6:
for f be PartFunc of REAL,REAL, a,b be Real
 st [.a,b.[ c= dom f & f is_right_ext_Riemann_integrable_on a,b holds
  for d be Real st a < d <= b holds f is_right_ext_Riemann_integrable_on a,d
proof
    let f be PartFunc of REAL,REAL, a,b be Real;
    assume that
A1:  [.a,b.[ c= dom f and
A2:  f is_right_ext_Riemann_integrable_on a,b;
    let d be Real;
    assume
A3:  a < d <= b; then
    per cases by XXREAL_0:1;
    suppose d = b;
     hence thesis by A2;
    end;
    suppose
A4:  d < b; then
     [.a,d.] c= [.a,b.[ by XXREAL_1:43; then
     ['a,d'] c= [.a,b.[ by A3,INTEGRA5:def 3; then
A5:  ['a,d'] c= dom f by A1;
     f is_integrable_on ['a,d'] & f|['a,d'] is bounded
       by A2,A3,A4,INTEGR10:def 1;
     hence thesis by A3,A5,Lm5;
    end;
end;

theorem Th25:
for f be PartFunc of REAL,REAL, a,b be Real
 st [.a,b.[ c= dom f & f is_right_ext_Riemann_integrable_on a,b holds
  for c be Real st a <= c < b holds
    f is_right_ext_Riemann_integrable_on c,b
  & ext_right_integral(f,a,b) = integral(f,a,c) + ext_right_integral(f,c,b)
proof
    let f be PartFunc of REAL,REAL, a,b be Real;
    assume that
A1:  [.a,b.[ c= dom f and
A2:  f is_right_ext_Riemann_integrable_on a,b;

    hereby let c be Real;
     assume that
A3:   a <= c and
A4:   c < b;

A5:  for d be Real st c <= d & d < b holds
       f is_integrable_on ['c,d'] & f|['c,d'] is bounded
     proof
      let d be Real;
      assume A6: c <= d < b; then
      a <= d < b by A3,XXREAL_0:2; then
A7:   f is_integrable_on ['a,d'] & f|['a,d'] is bounded by A2,INTEGR10:def 1;

A8:   ['a,d'] = [.a,d.] & ['c,d'] = [.c,d.]
        by A6,A3,XXREAL_0:2,INTEGRA5:def 3; then
      ['a,d'] c= [.a,b.[ by A6,XXREAL_1:43; then
      ['a,d'] c= dom f by A1;
      hence f is_integrable_on ['c,d'] by A3,A6,A7,INTEGRA6:18;
      thus f|['c,d'] is bounded by A7,A8,A3,XXREAL_1:34,RFUNCT_1:74;
     end;

     consider I be PartFunc of REAL,REAL such that
A9:   dom I = [.a,b.[ and
A10:   for x be Real st x in dom I holds I.x = integral(f,a,x) and
A11:   I is_left_convergent_in b by A2,INTEGR10:def 1;
     reconsider AB = [.c,b.[ as non empty Subset of REAL by A4,XXREAL_1:3;

     deffunc F(Element of AB) = In(integral(f,c,$1),REAL);
     consider Intf be Function of AB, REAL such that
A12:   for x being Element of AB holds Intf.x = F(x) from FUNCT_2:sch 4;
A13:  dom Intf = AB by FUNCT_2:def 1; then
     reconsider Intf as PartFunc of REAL,REAL by RELSET_1:5;
A14:  for x be Real st x in dom Intf holds Intf.x = integral(f,c,x)
     proof
      let x be Real;
      assume x in dom Intf; then
      Intf.x = In(integral(f,c,x),REAL) by A12,A13;
      hence thesis;
     end;

A15:  for r be Real st r < b ex g be Real st r < g < b & g in dom Intf
     proof
      let r be Real;
      assume r < b; then
      consider g be Real such that
A16:   max(r,c) < g < b by A4,XXREAL_0:29,XREAL_1:5;
      take g;
A17:  r <= max(r,c) & c <= max(r,c) by XXREAL_0:25;
      hence r < g < b by A16,XXREAL_0:2;
      c < g < b by A16,A17,XXREAL_0:2;
      hence g in dom Intf by A13,XXREAL_1:3;
     end;

     consider G be Real such that
A18:  for g1 be Real st 0 < g1
       ex r be Real st r < b &
        for r1 be Real st r < r1 < b & r1 in dom I holds |. I.r1 - G .| < g1
          by A11,LIMFUNC2:7;
     set G1=G-integral(f,a,c);

     for g1 be Real st 0 < g1
      ex r be Real st r < b &
       for r1 be Real st r < r1 < b & 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:   R < b and
A20:   for r1 be Real st R < r1 < b & r1 in dom I holds |. I.r1 - G .| < g1
         by A18;
      take R;

      thus R < b by A19;
      thus for r1 be Real st R < r1 < b & r1 in dom Intf
        holds |. Intf.r1 - G1 .| < g1
      proof
       let r1 be Real;
       assume that
A21:    R < r1 < b and
A22:    r1 in dom Intf;

A23:  c <= r1 by A13,A22,XXREAL_1:3; then
A24:  a <= r1 by A3,XXREAL_0:2; then
A25:  r1 in dom I by A9,A21,XXREAL_1:3;

A26:   f is_integrable_on ['a,r1'] & f|['a,r1'] is bounded
          by A21,A24,A2,INTEGR10:def 1;

A27:  ['a,r1'] = [.a,r1.] by A23,A3,XXREAL_0:2,INTEGRA5:def 3; then
       ['a,r1'] c= [.a,b.[ by A21,XXREAL_1:43; then
A28:   ['a,r1'] c= dom f by A1;
A29:  c in ['a,r1'] by A3,A27,A23,XXREAL_1:1;
A30:  r1 in ['a,r1'] by A24,A27,XXREAL_1:1;

       Intf.r1 = integral(f,c,r1) by A14,A22; then
       Intf.r1 - G1 = integral(f,c,r1) + integral(f,a,c) - G; then
       Intf.r1 - G1 = integral(f,a,r1) - G
         by A26,A28,A29,A30,A23,A3,XXREAL_0:2,INTEGRA6:20; then
       Intf.r1 - G1 = I.r1 - G by A10,A21,A24,A9,XXREAL_1:3;
       hence |. Intf.r1 - G1 .| < g1 by A20,A21,A25;
      end;
     end;
     hence
A31:   f is_right_ext_Riemann_integrable_on c,b
       by A5,A13,A14,A15,LIMFUNC2:7,INTEGR10:def 1;
     f is_integrable_on ['a,c'] & f|['a,c'] is bounded
       by A2,A3,A4,INTEGR10:def 1;
     hence ext_right_integral(f,a,b)
            = integral(f,a,c) + ext_right_integral(f,c,b)
            by A3,A4,A1,A31,Th21;
    end;
end;

theorem
for f be PartFunc of REAL,REAL, a,b be Real
 st [.a,b.[ c= dom f & f is_right_ext_Riemann_integrable_on a,b holds
  for c,d be Real st a <= c & c < d & d <= b holds
    f is_right_ext_Riemann_integrable_on c,d
  & (d < b implies ext_right_integral(f,c,d) = integral(f,c,d))
proof
    let f be PartFunc of REAL,REAL, a,b be Real;
    assume A1: [.a,b.[ c= dom f & f is_right_ext_Riemann_integrable_on a,b;
    hereby let c,d be Real;
     assume that
A2:   a <= c and
A3:   c < d and
A4:   d <= b;
     a < d by A2,A3,XXREAL_0:2; then
A5:  f is_right_ext_Riemann_integrable_on a,d by A1,A4,Lm6;

     [.a,d.[ c= [.a,b.[ by A4,XXREAL_1:38; then
     [.a,d.[ c= dom f by A1;
     hence f is_right_ext_Riemann_integrable_on c,d by A2,A3,A5,Th25;
     thus d < b implies ext_right_integral(f,c,d) = integral(f,c,d)
     proof
      assume
A6:    d < b;
       c < b by A3,A4,XXREAL_0:2; then
       f is_right_ext_Riemann_integrable_on c,b by A1,A2,Th25; then
A7:    f is_integrable_on ['c,d'] & f|['c,d'] is bounded
         by A3,A6,INTEGR10:def 1;
       ['c,d'] = [.c,d.] by A3,INTEGRA5:def 3; then
       ['c,d'] c= [.a,b.[ by A2,A6,XXREAL_1:43; then
       ['c,d'] c= dom f by A1;
       hence ext_right_integral(f,c,d) = integral(f,c,d)
         by A3,A7,INTEGR10:12;
     end;
    end;
end;

theorem
for f be PartFunc of REAL,REAL, a,b be Real
 st [.a,b.[ c= dom f & f is_right_ext_Riemann_integrable_on a,b holds
  for c,d be Real st a <= c & c < d & d < b holds
    f is_left_ext_Riemann_integrable_on c,d
  & ext_left_integral(f,c,d) = integral(f,c,d)
proof
   let f be PartFunc of REAL,REAL, a,b be Real;
   assume that
A1: [.a,b.[ c= dom f and
A2: f is_right_ext_Riemann_integrable_on a,b;

   hereby let c,d be Real;
    assume that
A3:  a <= c < d and
A4:  d < b;

A5: a < d by A3,XXREAL_0:2; then
    ['a,d'] = [.a,d.] & ['a,b'] = [.a,b.] & ['c,d'] = [.c,d.]
      by A3,A4,XXREAL_0:2,INTEGRA5:def 3; then
    ['a,d'] c= [.a,b.[ & ['c,d'] c= [.a,b.[ by A4,A3,XXREAL_1:43; then
A6: ['a,d'] c= dom f & ['c,d'] c= dom f by A1;
    f is_integrable_on [' a,d '] & f|[' a,d '] is bounded
       by A4,A5,A2,INTEGR10:def 1; then
A7: f is_integrable_on [' c,d '] & f|[' c,d '] is bounded by A3,A6,INTEGRA6:18;
    hence f is_left_ext_Riemann_integrable_on c,d by A3,A6,Th18;
    thus ext_left_integral(f,c,d) = integral(f,c,d) by A3,A6,A7,Th18;
   end;
end;

theorem Th28:
  for f,g be PartFunc of REAL,REAL, a,b be Real st a < b & ].a,b.] c=
  dom f & ].a,b.] c= dom g & f is_left_ext_Riemann_integrable_on a,b & g
  is_left_ext_Riemann_integrable_on a,b holds f + g
  is_left_ext_Riemann_integrable_on a,b & ext_left_integral(f + g,a,b) =
  ext_left_integral(f,a,b) + ext_left_integral(g,a,b)
proof
  let f,g be PartFunc of REAL,REAL, a,b be Real such that
A1: a < b and
A2: ].a,b.] c= dom f & ].a,b.] c= dom g and
A3: f is_left_ext_Riemann_integrable_on a,b and
A4: g is_left_ext_Riemann_integrable_on a,b;
  consider Intg be PartFunc of REAL,REAL such that
A5: dom Intg = ].a,b.] and
A6: for x be Real st x in dom Intg holds Intg.x = integral(g,x,b) and
A7: Intg is_right_convergent_in a and
A8: ext_left_integral(g,a,b) = lim_right(Intg,a) by A4,INTEGR10:def 4;
  consider Intf be PartFunc of REAL,REAL such that
A9: dom Intf = ].a,b.] and
A10: for x be Real st x in dom Intf holds Intf.x = integral(f,x,b) and
A11: Intf is_right_convergent_in a and
A12: ext_left_integral(f,a,b) = lim_right(Intf,a) by A3,INTEGR10:def 4;
  set Intfg = Intf + Intg;

A13:dom Intfg = ].a,b.] &
    for x be Real st x in dom Intfg holds Intfg.x = integral(f + g,x,b)
    proof
     thus
A14: dom Intfg = dom Intf /\ dom Intg by VALUED_1:def 1
      .= ].a,b.] by A9,A5;
     let x be Real;
    assume
A15: x in dom Intfg;
    then
A16: a < x by A14,XXREAL_1:2;
    then
A17: [.x,b.] c= ].a,b.] by XXREAL_1:39;
A18: x <= b by A14,A15,XXREAL_1:2;
    then
A19: f is_integrable_on [' x,b '] & f|[' x,b '] is bounded
       by A3,A16,INTEGR10:def 2;
    [' x,b '] = [.x,b.] by A18,INTEGRA5:def 3;
    then
A20: [' x,b '] c= dom f & [' x,b '] c= dom g by A2,A17;
A21: g is_integrable_on [' x,b '] & g|[' x,b '] is bounded
      by A4,A16,A18,INTEGR10:def 2;
    thus Intfg.x = Intf.x + Intg.x by A15,VALUED_1:def 1
      .= integral(f,x,b) + Intg.x by A9,A10,A14,A15
      .= integral(f,x,b) + integral(g,x,b) by A5,A6,A14,A15
      .= integral(f + g,x,b) by A18,A20,A19,A21,INTEGRA6:12;
  end;
A22: for r be Real st a < r
      ex g be Real st g < r & a < g & g in dom(Intf + Intg)
  proof
    let r be Real such that
A23: a < r;
    per cases;
    suppose
A24:  b < r;
      take g = b;
      thus thesis by A1,A13,A24,XXREAL_1:2;
    end;
    suppose
A25:  not b < r;
      take g = r - (r - a)/2;
A26:  0 < r - a by A23,XREAL_1:50;
      then (r - a)/2 < r - a by XREAL_1:216;
      then
A27:  (r - a)/2 + (a - (r - a)/2) < r - a + (a - (r - a)/2) by XREAL_1:8;
      0 < (r - a)/2 by A26,XREAL_1:215;
      then r - (r - a)/2 < b - 0 by A25,XREAL_1:15;
      hence thesis by A13,A27,A26,XREAL_1:44,215,XXREAL_1:2;
    end;
  end;
  then
A28: Intfg is_right_convergent_in a by A11,A7,LIMFUNC2:54;
  for d be Real st a < d & d <= b holds f + g is_integrable_on [' d,b ']
  & (f+g)|[' d,b '] is bounded
  proof
    let d be Real;
    assume
A29: a < d & d <= b;
    then
 [' d,b '] = [.d,b.] & [.d,b.] c= ].a,b.] by INTEGRA5:def 3,XXREAL_1:39;
    then
A30: [' d,b '] c= dom f & [' d,b '] c= dom g by A2;
A31: f is_integrable_on [' d,b '] & g is_integrable_on [' d,b ']
       by A3,A4,A29,INTEGR10:def 2;
A32: f|[' d,b '] is bounded & g|[' d,b '] is bounded
       by A3,A4,A29,INTEGR10:def 2;
    then (f + g)|([' d,b '] /\ [' d,b ']) is bounded by RFUNCT_1:83;
    hence thesis by A30,A31,A32,INTEGRA6:11;
  end;
  hence
A33: f + g is_left_ext_Riemann_integrable_on a,b
   by A13,A22,A11,A7,LIMFUNC2:54,INTEGR10:def 2;
  lim_right(Intfg,a) = ext_left_integral(f, a,b) + ext_left_integral(g,a,
  b) by A11,A12,A7,A8,A22,LIMFUNC2:54;
  hence thesis by A13,A28,A33,INTEGR10:def 4;
end;

theorem Th29:
for f,g be PartFunc of REAL,REAL, a,b be Real st a < b & [.a,b.[ c=
  dom f & [.a,b.[ c= dom g & f is_right_ext_Riemann_integrable_on a,b & g
  is_right_ext_Riemann_integrable_on a,b holds f + g
  is_right_ext_Riemann_integrable_on a,b & ext_right_integral(f + g,a,b) =
  ext_right_integral(f,a,b) + ext_right_integral(g,a,b)
proof
  let f,g be PartFunc of REAL,REAL, a,b be Real such that
A1: a < b and
A2: [.a,b.[ c= dom f & [.a,b.[ c= dom g and
A3: f is_right_ext_Riemann_integrable_on a,b and
A4: g is_right_ext_Riemann_integrable_on a,b;
  consider Intg be PartFunc of REAL,REAL such that
A5: dom Intg = [.a,b.[ and
A6: for x be Real st x in dom Intg holds Intg.x = integral(g,a,x) and
A7: Intg is_left_convergent_in b and
A8: ext_right_integral(g,a,b) = lim_left(Intg,b) by A4,INTEGR10:def 3;
  consider Intf be PartFunc of REAL,REAL such that
A9: dom Intf = [.a,b.[ and
A10: for x be Real st x in dom Intf holds Intf.x = integral(f,a,x) and
A11: Intf is_left_convergent_in b and
A12: ext_right_integral(f,a,b) = lim_left(Intf,b) by A3,INTEGR10:def 3;
  set Intfg = Intf + Intg;
A13: dom Intfg = [.a,b.[ &
  for x be Real st x in dom Intfg holds Intfg.x =
  integral(f + g,a,x)
  proof
    thus
A14: dom Intfg = dom Intf /\ dom Intg by VALUED_1:def 1
      .= [.a,b.[ by A9,A5;
    let x be Real;
    assume
A15: x in dom Intfg;
    then
A16: x < b by A14,XXREAL_1:3;
    then
A17: [.a,x.] c= [.a,b.[ by XXREAL_1:43;
A18: a <= x by A14,A15,XXREAL_1:3;
    then
A19: f is_integrable_on [' a,x '] & f|[' a,x '] is bounded
    by A3,A16,INTEGR10:def 1;
    [' a,x '] = [.a,x.] by A18,INTEGRA5:def 3;
    then
A20: [' a,x '] c= dom f & [' a,x '] c= dom g by A2,A17;
A21: g is_integrable_on [' a,x '] & g|[' a,x '] is bounded
   by A4,A18,A16,INTEGR10:def 1;
    thus Intfg.x = Intf.x + Intg.x by A15,VALUED_1:def 1
      .= integral(f,a,x) + Intg.x by A9,A10,A14,A15
      .= integral(f,a,x) + integral(g,a,x) by A5,A6,A14,A15
      .= integral(f + g,a,x) by A18,A20,A19,A21,INTEGRA6:12;
  end;
A22: for r be Real st r < b
      ex g be Real st r < g & g < b & g in dom(Intf + Intg)
  proof
    let r be Real such that
A23: r < b;
    per cases;
    suppose
A24:  r < a;
      take g = a;
      thus thesis by A1,A13,A24,XXREAL_1:3;
    end;
    suppose
      not r < a;
      then
A25:  a - a <= r - a by XREAL_1:9;
      take g = r + (b - r)/2;
A26:  0 < b - r by A23,XREAL_1:50;
      then (b - r)/2 < b - r by XREAL_1:216;
      then
A27:  (b - r)/2 + r < b - r + r by XREAL_1:8;
      r < g by A26,XREAL_1:29,215;
      then
A28:  r - (r - a) < g - 0 by A25,XREAL_1:14;
      0 < (b - r)/2 by A26,XREAL_1:215;
      hence thesis by A13,A28,A27,XREAL_1:8,XXREAL_1:3;
    end;
  end;
  then
A29: Intfg is_left_convergent_in b by A11,A7,LIMFUNC2:45;
  for d be Real st a <= d & d < b
holds f + g is_integrable_on [' a,d '] &
  (f+g)|[' a,d '] is bounded
  proof
    let d be Real;
    assume
A30: a <= d & d < b;
    then [' a,d '] = [.a,d.] & [.a,d.] c= [.a,b.[
     by INTEGRA5:def 3,XXREAL_1:43; then
A31: [' a,d '] c= dom f & [' a,d '] c= dom g by A2;
A32: f is_integrable_on [' a,d '] & g is_integrable_on [' a,d ']
   by A3,A4,A30,INTEGR10:def 1;
A33: f|[' a,d '] is bounded & g|[' a,d '] is bounded
  by A3,A4,A30,INTEGR10:def 1;
    then (f + g)|([' a,d '] /\ [' a,d ']) is bounded by RFUNCT_1:83;
    hence thesis by A31,A32,A33,INTEGRA6:11;
  end;
  hence
A34: f + g is_right_ext_Riemann_integrable_on a,b
   by A13,A22,A11,A7,LIMFUNC2:45,INTEGR10:def 1;
  lim_left(Intfg,b) = ext_right_integral(f,a,b) + ext_right_integral(g,a
  ,b) by A11,A12,A7,A8,A22,LIMFUNC2:45;
  hence thesis by A13,A29,A34,INTEGR10:def 3;
end;

theorem Th30:
  for f be PartFunc of REAL,REAL, a,b be Real st ].a,b.] c=
dom f & f is_left_ext_Riemann_integrable_on a,b holds for r be Real holds r(#)f
  is_left_ext_Riemann_integrable_on a,b & ext_left_integral(r(#)f,a,b) = r*
  ext_left_integral(f,a,b)
proof
  let f be PartFunc of REAL,REAL, a,b be Real such that
A1: ].a,b.] c= dom f and
A2: f is_left_ext_Riemann_integrable_on a,b;
  for r be Real holds r(#)f is_left_ext_Riemann_integrable_on a,b &
  ext_left_integral(r(#)f,a,b) = r*ext_left_integral(f,a,b)
  proof
    let r be Real;
    consider Intf be PartFunc of REAL,REAL such that
A3: dom Intf = ].a,b.] and
A4: for x be Real st x in dom Intf holds Intf.x = integral(f,x,b) and
A5: Intf is_right_convergent_in a and
A6: ext_left_integral(f,a,b) = lim_right(Intf,a) by A2,INTEGR10:def 4;
    set Intfg = r(#)Intf;
A7: Intfg is_right_convergent_in a by A5,LIMFUNC2:52;
A8: dom Intfg = ].a,b.] &
   for x be Real st x in dom Intfg holds Intfg.x =
    integral(r(#)f,x,b)
    proof
      thus
A9:  dom Intfg = ].a,b.] by A3,VALUED_1:def 5;
      let x be Real;
      assume
A10:  x in dom Intfg;
      then
A11:  a < x by A9,XXREAL_1:2;
      then
A12:  [.x,b.] c= ].a,b.] by XXREAL_1:39;
A13:  x <= b by A9,A10,XXREAL_1:2;
      then
A14:  [' x,b '] = [.x,b.] by INTEGRA5:def 3;
A15:  f is_integrable_on [' x,b '] & f|[' x,b '] is bounded
by A2,A11,A13,INTEGR10:def 2;
      thus Intfg.x = r*Intf.x by A10,VALUED_1:def 5
        .= r*integral(f,x,b) by A3,A4,A9,A10
        .= integral(r(#)f,x,b) by A1,A13,A14,A12,A15,INTEGRA6:10,XBOOLE_1:1
;
    end;
    for d be Real st a < d & d <= b
holds r(#)f is_integrable_on [' d,b ']
    & (r(#)f)|[' d,b '] is bounded
    proof
      let d be Real;
      assume
A16:  a < d & d <= b;
      then
A17:  [' d,b '] = [.d,b.] & [.d,b.] c= ].a,b.] by INTEGRA5:def 3,XXREAL_1:39;
A18:  f is_integrable_on [' d,b '] & f|[' d,b '] is bounded
by A2,A16,INTEGR10:def 2;
      [' d,b '] c= dom f by A1,A17;
      hence thesis by A18,INTEGRA6:9,RFUNCT_1:80;
    end;
    hence
A19: r(#)f is_left_ext_Riemann_integrable_on a,b
      by A8,A5,LIMFUNC2:52,INTEGR10:def 2;
    lim_right (Intfg,a) = r*ext_left_integral(f,a,b) by A5,A6,LIMFUNC2:52;
    hence thesis by A8,A7,A19,INTEGR10:def 4;
  end;
  hence thesis;
end;

theorem Th31:
  for f be PartFunc of REAL,REAL, a,b be Real st [.a,b.[ c= dom f
  & f is_right_ext_Riemann_integrable_on a,b holds for r be Real holds r(#)
  f is_right_ext_Riemann_integrable_on a,b & ext_right_integral(r(#)f,a,b) = r*
  ext_right_integral(f,a,b)
proof
  let f be PartFunc of REAL,REAL, a,b be Real such that
A1: [.a,b.[ c= dom f and
A2: f is_right_ext_Riemann_integrable_on a,b;
  for r be Real holds r(#)f is_right_ext_Riemann_integrable_on a,b &
  ext_right_integral(r(#)f,a,b) = r*ext_right_integral(f,a,b)
  proof
    let r be Real;
    consider Intf be PartFunc of REAL,REAL such that
A3: dom Intf = [.a,b.[ and
A4: for x be Real st x in dom Intf holds Intf.x =integral(f,a,x) and
A5: Intf is_left_convergent_in b and
A6: ext_right_integral(f,a,b) = lim_left(Intf,b) by A2,INTEGR10:def 3;
    set Intfg = r(#)Intf;
A7: Intfg is_left_convergent_in b by A5,LIMFUNC2:43;
A8: dom Intfg = [.a,b.[ &
   for x be Real st x in dom Intfg holds Intfg.x =
    integral(r(#)f,a,x)
    proof
      thus
A9:  dom Intfg = [.a,b.[ by A3,VALUED_1:def 5;
      let x be Real;
      assume
A10:  x in dom Intfg;
      then
A11:  a <= x by A9,XXREAL_1:3;
      then
A12:  [' a,x '] = [.a,x.] by INTEGRA5:def 3;
A13:  x < b by A9,A10,XXREAL_1:3;
      then
A14:  [.a,x.] c= [.a,b.[ by XXREAL_1:43;
A15:  f is_integrable_on [' a,x '] & f|[' a,x '] is bounded
by A2,A11,A13,INTEGR10:def 1;
      thus Intfg.x = r*Intf.x by A10,VALUED_1:def 5
        .= r*integral(f,a,x) by A3,A4,A9,A10
        .= integral(r(#)f,a,x) by A1,A11,A12,A14,A15,INTEGRA6:10,XBOOLE_1:1
;
    end;
    for d be Real
st a<= d & d < b holds r(#)f is_integrable_on [' a,d '] &
    (r(#)f)|[' a,d '] is bounded
    proof
      let d be Real;
      assume
A16:  a <= d & d < b;
      then
A17:  [' a,d '] = [.a,d.] & [.a,d.] c= [.a,b.[ by INTEGRA5:def 3,XXREAL_1:43;
A18:  f is_integrable_on [' a,d '] & f|[' a,d '] is bounded
by A2,A16,INTEGR10:def 1;
      [' a,d '] c= dom f by A1,A17;
      hence thesis by A18,INTEGRA6:9,RFUNCT_1:80;
    end;
    hence
A19: r(#)f is_right_ext_Riemann_integrable_on a,b
      by A8,A5,LIMFUNC2:43,INTEGR10:def 1;
    lim_left (Intfg,b) = r*ext_right_integral(f,a,b) by A5,A6,LIMFUNC2:43;
    hence thesis by A8,A7,A19,INTEGR10:def 3;
  end;
  hence thesis;
end;

begin :: Definition of Improper Integral

definition
  let f be PartFunc of REAL,REAL;
  let a,b be Real;
  pred f is_left_improper_integrable_on a,b means
  (for d be Real st
  a < d & d <= b holds f is_integrable_on [' d,b '] & f|[' d,b '] is bounded) &
ex Intf be PartFunc of REAL,REAL st dom Intf = ].a,b.] &
 (for x be Real st x in dom Intf holds Intf.x = integral(f,x,b))
 & (Intf is_right_convergent_in a
 or Intf is_right_divergent_to+infty_in a
 or Intf is_right_divergent_to-infty_in a);
end;

definition
  let f be PartFunc of REAL,REAL;
  let a,b be Real;
  pred f is_right_improper_integrable_on a,b means
  (for d be Real st
  a <= d & d < b holds f is_integrable_on [' a,d '] & f|[' a,d '] is bounded) &
ex Intf be PartFunc of REAL,REAL st dom Intf = [.a,b.[ &
 (for x be Real st x in dom Intf holds Intf.x = integral(f,a,x))
 & (Intf is_left_convergent_in b
 or Intf is_left_divergent_to+infty_in b
 or Intf is_left_divergent_to-infty_in b);
end;

definition
  let f be PartFunc of REAL,REAL;
  let a,b be Real;
  assume
A1: f is_left_improper_integrable_on a,b;
  func left_improper_integral(f,a,b) -> ExtReal means
  :Def3:
ex Intf be PartFunc of REAL,REAL st dom Intf = ].a,b.] &
 (for x be Real st x in dom Intf holds Intf.x = integral(f,x,b))
  & (Intf is_right_convergent_in a & it = lim_right(Intf,a)
  or Intf is_right_divergent_to+infty_in a & it = +infty
  or Intf is_right_divergent_to-infty_in a & it = -infty);
existence
proof
    consider Intf be PartFunc of REAL,REAL such that
A2:  dom Intf = ].a,b.] and
A3:  for x be Real st x in dom Intf holds Intf.x = integral(f,x,b) and
A4:  Intf is_right_convergent_in a or Intf is_right_divergent_to+infty_in a
     or Intf is_right_divergent_to-infty_in a by A1;
    per cases by A4;
    suppose A5: Intf is_right_convergent_in a;
     reconsider IT = lim_right(Intf,a) as ExtReal;
     take IT;
     thus thesis by A2,A3,A5;
    end;
    suppose A6: Intf is_right_divergent_to+infty_in a;
     take +infty;
     thus thesis by A2,A3,A6;
    end;
    suppose A7: Intf is_right_divergent_to-infty_in a;
     take -infty;
     thus thesis by A2,A3,A7;
    end;
end;
uniqueness
proof
    let y1,y2 be ExtReal;
    assume that
A8:  ex Intf be PartFunc of REAL,REAL st dom Intf = ].a,b.] &
      (for x be Real st x in dom Intf holds Intf.x = integral(f,x,b))
      & (Intf is_right_convergent_in a & y1 = lim_right(Intf,a)
      or Intf is_right_divergent_to+infty_in a & y1 = +infty
      or Intf is_right_divergent_to-infty_in a & y1 = -infty) and
A9:  ex Intf be PartFunc of REAL,REAL st dom Intf = ].a,b.] &
      (for x be Real st x in dom Intf holds Intf.x = integral(f,x,b))
      & (Intf is_right_convergent_in a & y2 = lim_right(Intf,a)
      or Intf is_right_divergent_to+infty_in a & y2 = +infty
      or Intf is_right_divergent_to-infty_in a & y2 = -infty);
    consider I0 be PartFunc of REAL,REAL such that
A10:  dom I0 = ].a,b.]
   & (for x be Real st x in dom I0 holds I0.x = integral(f,x,b))
   & (I0 is_right_convergent_in a or I0 is_right_divergent_to+infty_in a
     or I0 is_right_divergent_to-infty_in a) by A1;

    consider I1 be PartFunc of REAL,REAL such that
A11:  dom I1 = ].a,b.]
   & (for x be Real st x in dom I1 holds I1.x = integral(f,x,b))
   & (I1 is_right_convergent_in a & y1 = lim_right(I1,a)
    or I1 is_right_divergent_to+infty_in a & y1 = +infty
    or I1 is_right_divergent_to-infty_in a & y1 = -infty) by A8;
    consider I2 be PartFunc of REAL,REAL such that
A12:  dom I2 = ].a,b.]
   & (for x be Real st x in dom I2 holds I2.x = integral(f,x,b))
   & (I2 is_right_convergent_in a & y2 = lim_right(I2,a)
    or I2 is_right_divergent_to+infty_in a & y2 = +infty
    or I2 is_right_divergent_to-infty_in a & y2 = -infty) by A9;

    now let x be Element of REAL;
     assume A13: x in dom I0; then
     I0.x = integral(f,x,b) by A10;
     hence I0.x = I1.x by A11,A10,A13;
    end; then
A14: I0 = I1 by A10,A11,PARTFUN1:5;

    now let x be Element of REAL;
     assume A15: x in dom I1; then
     I1.x = integral(f,x,b) by A11;
     hence I1.x = I2.x by A11,A12,A15;
    end; then
A16: I1 = I2 by A11,A12,PARTFUN1:5;

    per cases by A10;
    suppose I0 is_right_convergent_in a;
     thus y1 = y2 by A11,A12,A16,Th8,Th9;
    end;
    suppose I0 is_right_divergent_to+infty_in a;
     hence y1 = y2 by A11,A12,A16,A14,Th8;
    end;
    suppose I0 is_right_divergent_to-infty_in a;
     hence y1 = y2 by A11,A12,A16,A14,Th9;
    end;
end;
end;

definition
  let f be PartFunc of REAL,REAL;
  let a,b be Real;
  assume
A1: f is_right_improper_integrable_on a,b;
  func right_improper_integral(f,a,b) -> ExtReal means
  :Def4:
ex Intf be PartFunc of REAL,REAL st dom Intf = [.a,b.[ &
 (for x be Real st x in dom Intf holds Intf.x = integral(f,a,x))
  & (Intf is_left_convergent_in b & it = lim_left(Intf,b)
  or Intf is_left_divergent_to+infty_in b & it = +infty
  or Intf is_left_divergent_to-infty_in b & it = -infty);
existence
proof
    consider Intf be PartFunc of REAL,REAL such that
A2:  dom Intf = [.a,b.[ and
A3:  for x be Real st x in dom Intf holds Intf.x = integral(f,a,x) and
A4:  Intf is_left_convergent_in b or Intf is_left_divergent_to+infty_in b
     or Intf is_left_divergent_to-infty_in b by A1;
    per cases by A4;
    suppose A5: Intf is_left_convergent_in b;
     reconsider IT = lim_left(Intf,b) as ExtReal;
     take IT;
     thus thesis by A2,A3,A5;
    end;
    suppose A6: Intf is_left_divergent_to+infty_in b;
     take +infty;
     thus thesis by A2,A3,A6;
    end;
    suppose A7: Intf is_left_divergent_to-infty_in b;
     take -infty;
     thus thesis by A2,A3,A7;
    end;
end;
uniqueness
proof
    let y1,y2 be ExtReal;
    assume that
A8:  ex Intf be PartFunc of REAL,REAL st dom Intf = [.a,b.[ &
      (for x be Real st x in dom Intf holds Intf.x = integral(f,a,x))
      & (Intf is_left_convergent_in b & y1 = lim_left(Intf,b)
      or Intf is_left_divergent_to+infty_in b & y1 = +infty
      or Intf is_left_divergent_to-infty_in b & y1 = -infty) and
A9:  ex Intf be PartFunc of REAL,REAL st dom Intf = [.a,b.[ &
      (for x be Real st x in dom Intf holds Intf.x = integral(f,a,x))
      & (Intf is_left_convergent_in b & y2 = lim_left(Intf,b)
      or Intf is_left_divergent_to+infty_in b & y2 = +infty
      or Intf is_left_divergent_to-infty_in b & y2 = -infty);
    consider I0 be PartFunc of REAL,REAL such that
A10:  dom I0 = [.a,b.[
   & (for x be Real st x in dom I0 holds I0.x = integral(f,a,x))
   & (I0 is_left_convergent_in b or I0 is_left_divergent_to+infty_in b
     or I0 is_left_divergent_to-infty_in b) by A1;

    consider I1 be PartFunc of REAL,REAL such that
A11:  dom I1 = [.a,b.[
   & (for x be Real st x in dom I1 holds I1.x = integral(f,a,x))
   & (I1 is_left_convergent_in b & y1 = lim_left(I1,b)
    or I1 is_left_divergent_to+infty_in b & y1 = +infty
    or I1 is_left_divergent_to-infty_in b & y1 = -infty) by A8;
    consider I2 be PartFunc of REAL,REAL such that
A12:  dom I2 = [.a,b.[
   & (for x be Real st x in dom I2 holds I2.x = integral(f,a,x))
   & (I2 is_left_convergent_in b & y2 = lim_left(I2,b)
    or I2 is_left_divergent_to+infty_in b & y2 = +infty
    or I2 is_left_divergent_to-infty_in b & y2 = -infty) by A9;

    now let x be Element of REAL;
     assume A13: x in dom I0; then
     I0.x = integral(f,a,x) by A10;
     hence I0.x = I1.x by A11,A10,A13;
    end; then
A14: I0 = I1 by A10,A11,PARTFUN1:5;

    now let x be Element of REAL;
     assume A15: x in dom I1; then
     I1.x = integral(f,a,x) by A11;
     hence I1.x = I2.x by A11,A12,A15;
    end; then
A16: I1 = I2 by A11,A12,PARTFUN1:5;

    per cases by A10;
    suppose I0 is_left_convergent_in b;
     thus y1 = y2 by A11,A12,A16,Th6,Th7;
    end;
    suppose I0 is_left_divergent_to+infty_in b;
     hence y1 = y2 by A11,A12,A14,A16,Th6;
    end;
    suppose I0 is_left_divergent_to-infty_in b;
     hence y1 = y2 by A11,A12,A14,A16,Th7;
    end;
end;
end;

theorem Th32:
for f be PartFunc of REAL,REAL, a,b be Real
 st f is_left_ext_Riemann_integrable_on a,b
 holds f is_left_improper_integrable_on a,b
proof
    let f be PartFunc of REAL,REAL, a,b be Real;
    assume f is_left_ext_Riemann_integrable_on a,b; then
    (for d be Real st a < d & d <= b holds
      f is_integrable_on [' d,b '] & f|[' d,b '] is bounded) &
    ex Intf be PartFunc of REAL,REAL st dom Intf = ].a,b.] &
      (for x be Real st x in dom Intf holds Intf.x = integral(f,x,b))
    & Intf is_right_convergent_in a by INTEGR10:def 2;
    hence thesis;
end;

theorem Th33:
for f be PartFunc of REAL,REAL, a,b be Real
 st f is_right_ext_Riemann_integrable_on a,b
 holds f is_right_improper_integrable_on a,b
proof
    let f be PartFunc of REAL,REAL, a,b be Real;
    assume f is_right_ext_Riemann_integrable_on a,b; then
    (for d be Real st a <= d & d < b holds
      f is_integrable_on [' a,d '] & f|[' a,d '] is bounded) &
    ex Intf be PartFunc of REAL,REAL st dom Intf = [.a,b.[ &
      (for x be Real st x in dom Intf holds Intf.x = integral(f,a,x))
    & Intf is_left_convergent_in b by INTEGR10:def 1;
    hence thesis;
end;

theorem Th34:
for f be PartFunc of REAL,REAL, a,b be Real st
 f is_left_improper_integrable_on a,b holds
   (f is_left_ext_Riemann_integrable_on a,b &
    left_improper_integral(f,a,b) = ext_left_integral(f,a,b))
or (not f is_left_ext_Riemann_integrable_on a,b &
    left_improper_integral(f,a,b) = +infty)
or (not f is_left_ext_Riemann_integrable_on a,b &
    left_improper_integral(f,a,b) = -infty)
proof
    let f be PartFunc of REAL,REAL, a,b be Real;
    assume
A1:  f is_left_improper_integrable_on a,b; then
    consider Intf be PartFunc of REAL,REAL such that
A2:  dom Intf = ].a,b.] &
     (for x be Real st x in dom Intf holds Intf.x = integral(f,x,b)) &
     (Intf is_right_convergent_in a or Intf is_right_divergent_to+infty_in a
     or Intf is_right_divergent_to-infty_in a);
    per cases by A2;
    suppose A3: Intf is_right_convergent_in a; then
A4:  f is_left_ext_Riemann_integrable_on a,b by A1,A2,INTEGR10:def 2;
     left_improper_integral(f,a,b) = lim_right(Intf,a) by A1,A2,A3,Def3
      .= ext_left_integral(f,a,b) by A2,A3,A4,INTEGR10:def 4;
     hence thesis by A1,A2,A3,INTEGR10:def 2;
    end;
    suppose A5: Intf is_right_divergent_to+infty_in a;
     for I be PartFunc of REAL,REAL st
      dom I = ].a,b.]
    & (for x be Real st x in dom I holds I.x = integral(f,x,b))
     holds not I is_right_convergent_in a
     proof
      let I be PartFunc of REAL,REAL;
      assume that
A6:    dom I = ].a,b.] and
A7:    for x be Real st x in dom I holds I.x = integral(f,x,b);
      now let x be Element of REAL;
       assume A8: x in dom Intf; then
       Intf.x = integral(f,x,b) by A2;
       hence Intf.x = I.x by A2,A6,A7,A8;
      end; then
      Intf = I by A2,A6,PARTFUN1:5;
      hence not I is_right_convergent_in a by A5,Th8;
     end;
     hence thesis by A1,Def3,INTEGR10:def 2;
    end;
    suppose A9: Intf is_right_divergent_to-infty_in a;
     for I be PartFunc of REAL,REAL st
      dom I = ].a,b.]
    & (for x be Real st x in dom I holds I.x = integral(f,x,b))
     holds not I is_right_convergent_in a
     proof
      let I be PartFunc of REAL,REAL;
      assume that
A10:   dom I = ].a,b.] and
A11:   for x be Real st x in dom I holds I.x = integral(f,x,b);
      now let x be Element of REAL;
       assume A12: x in dom Intf; then
       Intf.x = integral(f,x,b) by A2;
       hence Intf.x = I.x by A2,A10,A11,A12;
      end; then
      Intf = I by A2,A10,PARTFUN1:5;
      hence not I is_right_convergent_in a by A9,Th9;
     end;
     hence thesis by A1,Def3,INTEGR10:def 2;
    end;
end;

theorem Th35:
for f be PartFunc of REAL,REAL, a,b be Real st
  ex Intf be PartFunc of REAL,REAL st dom Intf = ].a,b.] &
   (for x be Real st x in dom Intf holds Intf.x = integral(f,x,b)) &
    (Intf is_right_divergent_to+infty_in a or
     Intf is_right_divergent_to-infty_in a)
 holds not f is_left_ext_Riemann_integrable_on a,b
proof
    let f be PartFunc of REAL,REAL, a,b be Real;
    assume ex Intf be PartFunc of REAL,REAL st dom Intf = ].a,b.] &
     (for x be Real st x in dom Intf holds Intf.x = integral(f,x,b)) &
     (Intf is_right_divergent_to+infty_in a or
       Intf is_right_divergent_to-infty_in a); then
    consider Intf be PartFunc of REAL,REAL such that
A1:     dom Intf = ].a,b.] and
A2:  for x be Real st x in dom Intf holds Intf.x = integral(f,x,b) and
A3:  Intf is_right_divergent_to+infty_in a
    or Intf is_right_divergent_to-infty_in a;

    hereby assume f is_left_ext_Riemann_integrable_on a,b; then
     consider I be PartFunc of REAL,REAL such that
A4:   dom I = ].a,b.] and
A5:   for x be Real st x in dom I holds I.x = integral(f,x,b) and
A6:   I is_right_convergent_in a by INTEGR10:def 2;
     now let x be Element of REAL;
      assume A7: x in dom I; then
      I.x = integral(f,x,b) by A5;
      hence I.x = Intf.x by A1,A4,A7,A2;
     end; then
     I = Intf by A1,A4,PARTFUN1:5;
     hence contradiction by A3,A6,Th8,Th9;
    end;
end;

theorem
for f,Intf be PartFunc of REAL,REAL, a,b be Real st
 f is_left_improper_integrable_on a,b &
 dom Intf = ].a,b.] &
 (for x be Real st x in dom Intf holds Intf.x = integral(f,x,b)) &
 Intf is_right_convergent_in a
holds left_improper_integral(f,a,b) = lim_right(Intf,a)
proof
    let f,Intf be PartFunc of REAL,REAL, a,b be Real;
    assume that
A1:  f is_left_improper_integrable_on a,b and
A2:  dom Intf = ].a,b.] and
A3:  for x be Real st x in dom Intf holds Intf.x = integral(f,x,b) and
A4:  Intf is_right_convergent_in a;

A5: f is_left_ext_Riemann_integrable_on a,b by A1,A2,A3,A4,INTEGR10:def 2;
    then
A6: left_improper_integral(f,a,b) = ext_left_integral(f,a,b) by A1,Th34;

    consider I be PartFunc of REAL,REAL such that
A7:  dom I = ].a,b.] and
A8:  for x be Real st x in dom I holds I.x = integral(f,x,b) and
     I is_right_convergent_in a and
A9:  ext_left_integral(f,a,b) = lim_right(I,a) by A5,INTEGR10:def 4;

    now let x be Element of REAL;
     assume A10: x in dom Intf; then
     Intf.x = integral(f,x,b) by A3;
     hence Intf.x = I.x by A2,A7,A8,A10;
    end;
    hence left_improper_integral(f,a,b) = lim_right(Intf,a)
      by A6,A9,A2,A7,PARTFUN1:5;
end;

Lm7:
for f be PartFunc of REAL,REAL, a,c be Real st
  ].a,c.] c= dom f & f is_left_improper_integrable_on a,c holds
for b be Real st a < b <= c holds
 for d be Real st a < d & d <= b holds
     f is_integrable_on ['d,b'] & f|['d,b'] is bounded
proof
    let f be PartFunc of REAL,REAL, a,c be Real;
    assume that
A1:  ].a,c.] c= dom f and
A2:  f is_left_improper_integrable_on a,c;
    let b be Real;
    assume
A3:  a < b <= c;
    thus for d be Real st a < d & d <= b holds
     f is_integrable_on ['d,b'] & f|['d,b'] is bounded
    proof
     let d be Real;
     assume A4: a < d & d <= b; then
A5:  a < d & d <= c by A3,XXREAL_0:2; then
A6:  f is_integrable_on ['d,c'] & f|['d,c'] is bounded by A2;
A7:  [.d,c.] = ['d,c'] by A4,A3,XXREAL_0:2,INTEGRA5:def 3; then
     ['d,c'] c= ].a,c.] by A4,XXREAL_1:39; then
A8:  ['d,c'] c= dom f by A1;
     b in ['d,c'] by A7,A4,A3,XXREAL_1:1;
     hence f is_integrable_on ['d,b'] by A6,A5,A8,INTEGRA6:17;
     [.d,b.] = ['d,b'] by A4,INTEGRA5:def 3;
     hence f|['d,b'] is bounded by A6,A3,A7,XXREAL_1:34,RFUNCT_1:74;
    end;
end;

Lm8:
for f be PartFunc of REAL,REAL, a,c be Real st
  ].a,c.] c= dom f & f is_left_improper_integrable_on a,c
& left_improper_integral(f,a,c) = ext_left_integral(f,a,c) holds
 for b be Real st a < b <= c holds
  f is_left_improper_integrable_on a,b
& left_improper_integral(f,a,b) = ext_left_integral(f,a,b)
proof
    let f be PartFunc of REAL,REAL, a,c be Real;
    assume that
A1:  ].a,c.] c= dom f and
A2:  f is_left_improper_integrable_on a,c and
A3:  left_improper_integral(f,a,c) = ext_left_integral(f,a,c);
    let b be Real;
    assume
A4:  a < b <= c;

A5: for d be Real st a < d & d <= b holds
     f is_integrable_on ['d,b'] & f|['d,b'] is bounded by A1,A2,A4,Lm7;

    consider I be PartFunc of REAL,REAL such that
A6:  dom I = ].a,c.] and
A7:  for x be Real st x in dom I holds I.x = integral(f,x,c) and
A8:  (I is_right_convergent_in a or I is_right_divergent_to+infty_in a
     or I is_right_divergent_to-infty_in a) by A2;

A9: now assume I is_right_divergent_to+infty_in a; then
     not f is_left_ext_Riemann_integrable_on a,c by A6,A7,Th35;
     hence contradiction by A2,A3,Th34;
    end;

A10: now assume I is_right_divergent_to-infty_in a; then
     not f is_left_ext_Riemann_integrable_on a,c by A6,A7,Th35;
     hence contradiction by A2,A3,Th34;
    end;

    reconsider AB = ].a,b.] as non empty Subset of REAL by A4,XXREAL_1:2;
    deffunc F(Element of AB) = In(integral(f,$1,b),REAL);
    consider Intf be Function of AB,REAL such that
A11:  for x be Element of AB holds Intf.x = F(x) from FUNCT_2:sch 4;
A12: dom Intf = AB by FUNCT_2:def 1; then
    reconsider Intf as PartFunc of REAL,REAL by RELSET_1:5;

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 A11,A12;
     hence thesis;
    end;

A14: for r be Real st a < r ex g be Real st g < r & a < g & g in dom Intf
    proof
     let r be Real;
     assume
A15:   a < r;
     set R = min(b,r);
     consider g be Real such that
A16:   g < R & a < g & g in dom I by A8,A9,A10,A15,A4,XXREAL_0:21,LIMFUNC2:10;
     R <= b & R <= r by XXREAL_0:17; then
A17:  g < b & g < r by A16,XXREAL_0:2; then
     g in ].a,b.] by A16,XXREAL_1:2;
     hence thesis by A12,A17,A16;
    end;

    consider g be Real such that
A18:  for g1 be Real st 0 < g1
      ex r be Real st a < r & for r1 be Real st r1 < r & a < r1 & r1 in dom I
        holds |. I.r1-g .| < g1 by A8,A9,A10,LIMFUNC2:10;
    set G = g-integral(f,b,c);

A19: for g1 be Real st 0 <g1
     ex r be Real st a < r
      & for r1 be Real st r1 < r & a < r1 & r1 in dom Intf holds
        |. Intf.r1-G .| < g1
    proof
     let g1 be Real;
     assume 0 < g1; then
     consider r be Real such that
A20:   a < r and
A21:   for r1 be Real st r1 < r & a < r1 & r1 in dom I holds |. I.r1-g .| < g1
        by A18;
     set R = min(b,r);
     for r1 be Real st r1 < R & a < r1 & r1 in dom Intf holds
      |. Intf.r1-G .| < g1
     proof
      let r1 be Real;
      assume that
A22:   r1 < R and
A23:   a < r1 and
A24:   r1 in dom Intf;
      R <= r & R <= b by XXREAL_0:17; then
A25:  r1 < r & r1 < b by A22,XXREAL_0:2;
A26: dom Intf c= dom I by A4,A6,A12,XXREAL_1:42; then
A27:  |. I.r1 - g .| < g1 by A25,A23,A21,A24;

A28:   r1 <= c by A6,A24,A26,XXREAL_1:2; then
A29:   f is_integrable_on ['r1,c'] & f|['r1,c'] is bounded by A2,A23;
A30:   [.r1,c.] = ['r1,c'] by A28,INTEGRA5:def 3; then
      ['r1,c'] c= ].a,c.] by A23,XXREAL_1:39; then
A31:   ['r1,c'] c= dom f by A1;
A32:   b in ['r1,c'] by A25,A4,A30,XXREAL_1:1;

      I.r1 - g = integral(f,r1,c) - g by A7,A24,A26
       .= integral(f,r1,b)+integral(f,b,c) - g by A28,A29,A31,A32,INTEGRA6:17
       .= integral(f,r1,b) - (g - integral(f,b,c));
      hence |. Intf.r1 - G .| < g1 by A24,A27,A13;
     end;
     hence thesis by A20,A4,XXREAL_0:21;
    end;
    hence A33: f is_left_improper_integrable_on a,b
      by A12,A13,A14,A1,A2,A4,Lm7,LIMFUNC2:10;
    f is_left_ext_Riemann_integrable_on a,b
      by A5,A12,A13,A14,A19,LIMFUNC2:10,INTEGR10:def 2;
    hence left_improper_integral(f,a,b) = ext_left_integral(f,a,b) by A33,Th34;
end;

Lm9:
for f be PartFunc of REAL,REAL, a,c be Real st
  ].a,c.] c= dom f & f is_left_improper_integrable_on a,c
& left_improper_integral(f,a,c) = +infty holds
for b be Real st a < b <= c holds
  f is_left_improper_integrable_on a,b & left_improper_integral(f,a,b) = +infty
proof
    let f be PartFunc of REAL,REAL, a,c be Real;
    assume that
A1:  ].a,c.] c= dom f and
A2:  f is_left_improper_integrable_on a,c and
A3:  left_improper_integral(f,a,c) = +infty;
    let b be Real;
    assume
A4:  a < b <= c;

    consider I be PartFunc of REAL,REAL such that
A5:  dom I = ].a,c.] and
A6:  for x be Real st x in dom I holds I.x = integral(f,x,c) and
A7:  (I is_right_convergent_in a or I is_right_divergent_to+infty_in a
     or I is_right_divergent_to-infty_in a) by A2;
    left_improper_integral(f,a,c) <> ext_left_integral(f,a,c)
      by A3; then
A8: not f is_left_ext_Riemann_integrable_on a,c by A2,Th34;

    reconsider AB = ].a,b.] as non empty Subset of REAL by A4,XXREAL_1:2;
    deffunc F(Element of AB) = In(integral(f,$1,b),REAL);
    consider Intf be Function of AB,REAL such that
A9:  for x be Element of AB holds Intf.x = F(x) from FUNCT_2:sch 4;
A10: dom Intf = AB by FUNCT_2:def 1; then
    reconsider Intf as PartFunc of REAL,REAL by RELSET_1:5;

A11: 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 A9,A10;
     hence thesis;
    end;

A12: for r be Real st a < r ex g be Real st g < r & a < g & g in dom Intf
    proof
     let r be Real;
     assume A13: a < r;
     set R = min(b,r);
     consider g be Real such that
A14:   g < R & a < g & g in dom I
       by A8,A3,A2,A5,Def3,INTEGR10:def 2,A4,A13,XXREAL_0:21,LIMFUNC2:11;
     R <= b & R <= r by XXREAL_0:17; then
A15:  g < b & g < r by A14,XXREAL_0:2; then
     g in dom Intf by A14,A10,XXREAL_1:2;
     hence thesis by A14,A15;
    end;

A16: for g1 be Real ex r be Real st a < r & for r1 be Real st r1 < r & a < r1 &
     r1 in dom Intf holds g1 < Intf.r1
    proof
     let g1 be Real;
     consider r be Real such that
A17:   a < r and
A18:   for r1 be Real st r1 < r & a < r1 & r1 in dom I
        holds g1+integral(f,b,c) < I.r1
          by A8,A7,A3,A2,A5,A6,Def3,INTEGR10:def 2,LIMFUNC2:11;
     set R = min(b,r);
     take R;
     thus a < R by A4,A17,XXREAL_0:21;
     thus for r1 be Real st r1 < R & a < r1 & r1 in dom Intf holds g1 < Intf.r1
     proof
      let r1 be Real;
      assume A19: r1 < R & a < r1 & r1 in dom Intf;
      R <= b & R <= r by XXREAL_0:17; then
A20:   r1 < b & r1 < r by A19,XXREAL_0:2; then
A21:   r1 < c by A4,XXREAL_0:2; then
      r1 in dom I by A5,A19,XXREAL_1:2; then
      g1+integral(f,b,c) < I.r1 by A18,A19,A20; then
A22:   g1 + integral(f,b,c) < integral(f,r1,c) by A6,A21,A5,A19,XXREAL_1:2;

A23:   f is_integrable_on ['r1,c'] & f|['r1,c'] is bounded by A19,A21,A2;
A24:   ['r1,c'] = [.r1,c.] by A20,A4,XXREAL_0:2,INTEGRA5:def 3; then
      ['r1,c'] c= ].a,c.] by A19,XXREAL_1:39; then
A25:   ['r1,c'] c= dom f by A1;
      b in ['r1,c'] by A24,A20,A4,XXREAL_1:1; then
      integral(f,r1,c) = integral(f,r1,b) + integral(f,b,c)
        by A21,A23,A25,INTEGRA6:17; then
      g1 < integral(f,r1,b) by A22,XREAL_1:6;
      hence g1 < Intf.r1 by A11,A19;
     end;
    end;
    hence
A26:  f is_left_improper_integrable_on a,b
      by A10,A11,A1,A2,A4,Lm7,A12,LIMFUNC2:11;
    Intf is_right_divergent_to+infty_in a by A12,A16,LIMFUNC2:11;
    hence left_improper_integral(f,a,b) = +infty by A10,A11,A26,Def3;
end;

Lm10:
for f be PartFunc of REAL,REAL, a,c be Real st
  ].a,c.] c= dom f & f is_left_improper_integrable_on a,c
& left_improper_integral(f,a,c) = -infty holds
for b be Real st a < b <= c holds
  f is_left_improper_integrable_on a,b & left_improper_integral(f,a,b) = -infty
proof
    let f be PartFunc of REAL,REAL, a,c be Real;
    assume that
A1:  ].a,c.] c= dom f and
A2:  f is_left_improper_integrable_on a,c and
A3:  left_improper_integral(f,a,c) = -infty;
    let b be Real;
    assume
A4:  a < b <= c;

    consider I be PartFunc of REAL,REAL such that
A5:  dom I = ].a,c.] and
A6:  for x be Real st x in dom I holds I.x = integral(f,x,c) and
A7:  (I is_right_convergent_in a or I is_right_divergent_to+infty_in a
     or I is_right_divergent_to-infty_in a) by A2;
    left_improper_integral(f,a,c) <> ext_left_integral(f,a,c)
      by A3; then
A8: not f is_left_ext_Riemann_integrable_on a,c by A2,Th34;

    reconsider AB = ].a,b.] as non empty Subset of REAL by A4,XXREAL_1:2;
    deffunc F(Element of AB) = In(integral(f,$1,b),REAL);
    consider Intf be Function of AB,REAL such that
A9:  for x be Element of AB holds Intf.x = F(x) from FUNCT_2:sch 4;
A10: dom Intf = AB by FUNCT_2:def 1; then
    reconsider Intf as PartFunc of REAL,REAL by RELSET_1:5;

A11: 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 A9,A10;
     hence thesis;
    end;

A12: for r be Real st a < r ex g be Real st g < r & a < g & g in dom Intf
    proof
     let r be Real;
     assume A13: a < r;
     set R = min(b,r);
     consider g be Real such that
A14:   g < R & a < g & g in dom I
       by A8,A3,A2,A5,Def3,INTEGR10:def 2,A4,A13,XXREAL_0:21,LIMFUNC2:12;
     R <= b & R <= r by XXREAL_0:17; then
A15:  g < b & g < r by A14,XXREAL_0:2; then
     g in dom Intf by A14,A10,XXREAL_1:2;
     hence thesis by A14,A15;
    end;

A16: for g1 be Real ex r be Real st a < r & for r1 be Real st r1 < r & a < r1 &
     r1 in dom Intf holds Intf.r1 < g1
    proof
     let g1 be Real;
     consider r be Real such that
A17:   a < r and
A18:   for r1 be Real st r1 < r & a < r1 & r1 in dom I
        holds I.r1 < g1+integral(f,b,c)
          by A8,A7,A3,A2,A5,A6,Def3,INTEGR10:def 2,LIMFUNC2:12;
     set R = min(b,r);
     take R;
     thus a < R by A4,A17,XXREAL_0:21;
     thus for r1 be Real st r1 < R & a < r1 & r1 in dom Intf holds Intf.r1 < g1
     proof
      let r1 be Real;
      assume A19: r1 < R & a < r1 & r1 in dom Intf;
      R <= b & R <= r by XXREAL_0:17; then
A20:   r1 < b & r1 < r by A19,XXREAL_0:2; then
A21:   r1 < c by A4,XXREAL_0:2; then
      r1 in dom I by A5,A19,XXREAL_1:2; then
      I.r1 < g1+integral(f,b,c) by A18,A19,A20; then
A22:   integral(f,r1,c) < g1 + integral(f,b,c) by A6,A21,A5,A19,XXREAL_1:2;

A23:   f is_integrable_on ['r1,c'] & f|['r1,c'] is bounded by A19,A21,A2;
A24:   ['r1,c'] = [.r1,c.] by A20,A4,XXREAL_0:2,INTEGRA5:def 3; then
      ['r1,c'] c= ].a,c.] by A19,XXREAL_1:39; then
A25:   ['r1,c'] c= dom f by A1;
      b in ['r1,c'] by A24,A20,A4,XXREAL_1:1; then
      integral(f,r1,c) = integral(f,r1,b) + integral(f,b,c)
        by A21,A23,A25,INTEGRA6:17; then
      integral(f,r1,b) < g1 by A22,XREAL_1:6;
      hence Intf.r1 < g1 by A11,A19;
     end;
    end;
    hence
A26:  f is_left_improper_integrable_on a,b
      by A10,A11,A1,A2,A4,Lm7,A12,LIMFUNC2:12;
    Intf is_right_divergent_to-infty_in a by A12,A16,LIMFUNC2:12;
    hence left_improper_integral(f,a,b) = -infty by A10,A11,A26,Def3;
end;

theorem Th37:
for f be PartFunc of REAL,REAL, a,b,c be Real st a < b <= c & ].a,c.] c= dom f
 & f is_left_improper_integrable_on a,c holds
  f is_left_improper_integrable_on a,b &
  ( left_improper_integral(f,a,c) = ext_left_integral(f,a,c)
     implies left_improper_integral(f,a,b) = ext_left_integral(f,a,b) ) &
  ( left_improper_integral(f,a,c) = +infty
     implies left_improper_integral(f,a,b) = +infty ) &
  ( left_improper_integral(f,a,c) = -infty
     implies left_improper_integral(f,a,b) = -infty )
proof
    let f be PartFunc of REAL,REAL, a,b,c be Real;
    assume that
A1:  a < b <= c and
A2:  ].a,c.] c= dom f and
A3:  f is_left_improper_integrable_on a,c;

    per cases;
    suppose f is_left_ext_Riemann_integrable_on a,c; then
     left_improper_integral(f,a,c) = ext_left_integral(f,a,c) by A3,Th34;
     hence thesis by A1,A2,A3,Lm8;
    end;
    suppose not f is_left_ext_Riemann_integrable_on a,c; then
     per cases by A3,Th34;
     suppose left_improper_integral(f,a,c) = +infty;
      hence thesis by A1,A2,A3,Lm9;
     end;
     suppose left_improper_integral(f,a,c) = -infty;
      hence thesis by A1,A2,A3,Lm10;
     end;
    end;
end;

Lm11:
for f be PartFunc of REAL,REAL, a,b,c be Real
 st a < b <= c & ].a,c.] c= dom f & f|['b,c'] is bounded
  & f is_left_improper_integrable_on a,b & f is_integrable_on ['b,c']
holds for d be Real st a < d & d <= c holds
        f is_integrable_on ['d,c'] & f|['d,c'] is bounded
proof
    let f be PartFunc of REAL,REAL, a,b,c be Real;
    assume that
A1:  a < b <= c and
A2:  ].a,c.] c= dom f and
A3:  f|['b,c'] is bounded and
A4:  f is_left_improper_integrable_on a,b and
A5:  f is_integrable_on ['b,c'];

    hereby let d be Real;
     assume
A6:   a < d & d <= c; then
     ['d,c'] = [.d,c.] by INTEGRA5:def 3; then
     ['d,c'] c= ].a,c.] by A6,XXREAL_1:39; then
A7:  ['d,c'] c= dom f by A2;

A8: ['b,c'] = [.b,c.] & ['d,c'] = [.d,c.] by A1,A6,INTEGRA5:def 3;

     per cases;
     suppose A9: d <= b; then
A10:  f is_integrable_on ['d,b'] & f|['d,b'] is bounded by A4,A6;
      hence f is_integrable_on ['d,c'] by A9,A1,A7,A3,A5,Th1;
      ['d,b'] = [.d,b.] by A9,INTEGRA5:def 3; then
      ['d,b'] \/ ['b,c'] = [.d,c.] by A9,A1,A8,XXREAL_1:165;
      hence f|['d,c'] is bounded by A10,A3,A8,RFUNCT_1:87;
     end;
     suppose A11: b < d;
      [.b,c.] c= ].a,c.] by A1,XXREAL_1:39; then
A12:  ['b,c'] c= dom f by A2,A8;
      d in ['b,c'] by A8,A11,A6,XXREAL_1:1;
      hence f is_integrable_on ['d,c'] by A1,A3,A5,A12,INTEGRA6:17;
      thus f|['d,c'] is bounded by A3,A11,A8,XXREAL_1:34,RFUNCT_1:74;
     end;
    end;
end;

Lm12:
for f be PartFunc of REAL,REAL, a,b,c be Real
 st a < b <= c & ].a,c.] c= dom f & f|['b,c'] is bounded
  & f is_left_improper_integrable_on a,b & f is_integrable_on ['b,c']
  & left_improper_integral(f,a,b) = ext_left_integral(f,a,b)
holds f is_left_improper_integrable_on a,c
  & left_improper_integral(f,a,c)
     = left_improper_integral(f,a,b) + integral(f,b,c)
proof
    let f be PartFunc of REAL,REAL, a,b,c be Real;
    assume that
A1:  a < b <= c and
A2:  ].a,c.] c= dom f and
A3:  f|['b,c'] is bounded and
A4:  f is_left_improper_integrable_on a,b and
A5:  f is_integrable_on ['b,c'] and
A6:  left_improper_integral(f,a,b) = ext_left_integral(f,a,b);

    consider I be PartFunc of REAL,REAL such that
A7:  dom I = ].a,b.] and
A8:  for x be Real st x in dom I holds I.x = integral(f,x,b) and
A9:  (I is_right_convergent_in a or I is_right_divergent_to+infty_in a
     or I is_right_divergent_to-infty_in a) by A4;

A10: now assume I is_right_divergent_to+infty_in a; then
     not f is_left_ext_Riemann_integrable_on a,b by A7,A8,Th35;
     hence contradiction by A4,A6,Th34;
    end;

    now assume I is_right_divergent_to-infty_in a; then
     not f is_left_ext_Riemann_integrable_on a,b by A7,A8,Th35;
     hence contradiction by A4,A6,Th34;
    end; then
    f is_left_ext_Riemann_integrable_on a,b
      by A4,A7,A8,A9,A10,INTEGR10:def 2; then
A11: f is_left_ext_Riemann_integrable_on a,c
  & ext_left_integral(f,a,c) = ext_left_integral(f,a,b) + integral(f,b,c)
      by A1,A2,A3,A5,Th20;

    ex Intf be PartFunc of REAL,REAL st dom Intf = ].a,c.] &
     (for x be Real st x in dom Intf holds Intf.x = integral(f,x,c)) &
     Intf is_right_convergent_in a by A11,INTEGR10:def 2;
    hence f is_left_improper_integrable_on a,c by A1,A2,A3,A4,A5,Lm11; then
    left_improper_integral(f,a,c)
     = ext_left_integral(f,a,b) + integral(f,b,c) by A11,Th34;
    hence left_improper_integral(f,a,c)
         = left_improper_integral(f,a,b) + integral(f,b,c)
           by A6,XXREAL_3:def 2;
end;

Lm13:
for f be PartFunc of REAL,REAL, a,b,c be Real
 st a < b <= c & ].a,c.] c= dom f & f|['b,c'] is bounded
  & f is_left_improper_integrable_on a,b & f is_integrable_on ['b,c']
  & left_improper_integral(f,a,b) = +infty
holds f is_left_improper_integrable_on a,c
  & left_improper_integral(f,a,c) = +infty
proof
    let f be PartFunc of REAL,REAL, a,b,c be Real;
    assume that
A1:  a < b <= c and
A2:  ].a,c.] c= dom f and
A3:  f|['b,c'] is bounded and
A4:  f is_left_improper_integrable_on a,b and
A5:  f is_integrable_on ['b,c'] and
A6:  left_improper_integral(f,a,b) = +infty;

    consider I be PartFunc of REAL,REAL such that
A7:  dom I = ].a,b.] and
A8:  for x be Real st x in dom I holds I.x = integral(f,x,b) and
A9:  (I is_right_convergent_in a or I is_right_divergent_to+infty_in a
     or I is_right_divergent_to-infty_in a) by A4;

    left_improper_integral(f,a,b) <> ext_left_integral(f,a,b)
      by A6; then
A10: not f is_left_ext_Riemann_integrable_on a,b by A4,Th34;

    reconsider AC = ].a,c.] as non empty Subset of REAL by A1,XXREAL_1:2;
    deffunc F(Element of AC) = In(integral(f,$1,c),REAL);
    consider Intf be Function of AC,REAL such that
A11:  for x be Element of AC holds Intf.x = F(x) from FUNCT_2:sch 4;
A12: dom Intf = AC by FUNCT_2:def 1; then
    reconsider Intf as PartFunc of REAL,REAL by RELSET_1:5;

A13: for x be Real st x in dom Intf holds Intf.x = integral(f,x,c)
    proof
     let x be Real;
     assume x in dom Intf; then
     Intf.x = In(integral(f,x,c),REAL) by A11,A12;
     hence thesis;
    end;

A14: for r be Real st a < r ex g be Real st g < r & a < g & g in dom Intf
    proof
     let r be Real;
     assume a < r; then
     consider g be Real such that
A15:   g < r & a < g & g in dom I
        by A10,A6,A7,Def3,INTEGR10:def 2,A4,LIMFUNC2:11;
     ].a,b.] c= ].a,c.] by A1,XXREAL_1:42;
     hence thesis by A15,A7,A12;
    end;

A16: for g1 be Real ex r be Real st a < r & for r1 be Real st r1 < r & a < r1 &
     r1 in dom Intf holds g1 < Intf.r1
    proof
     let g1 be Real;
     consider r be Real such that
A17:   a < r and
A18:   for r1 be Real st r1 < r & a < r1 & r1 in dom I
        holds g1-integral(f,b,c) < I.r1
          by A10,A9,A4,A6,A7,A8,Def3,INTEGR10:def 2,LIMFUNC2:11;
     set R = min(b,r);
     take R;
     thus a < R by A1,A17,XXREAL_0:21;
     thus for r1 be Real st r1 < R & a < r1 & r1 in dom Intf holds g1 < Intf.r1
     proof
      let r1 be Real;
      assume A19: r1 < R & a < r1 & r1 in dom Intf;
      R <= b & R <= r by XXREAL_0:17; then
A20:   r1 < b & r1 < r by A19,XXREAL_0:2; then
A21:   r1 < c by A1,XXREAL_0:2;

      r1 in dom I by A7,A19,A20,XXREAL_1:2; then
      g1-integral(f,b,c) < I.r1 by A18,A19,A20; then
A22:   g1-integral(f,b,c) < integral(f,r1,b) by A8,A20,A7,A19,XXREAL_1:2;

A23:   f is_integrable_on ['r1,c'] & f|['r1,c'] is bounded
        by A19,A21,A1,A2,A3,A4,A5,Lm11;
A24:   ['r1,c'] = [.r1,c.] by A20,A1,XXREAL_0:2,INTEGRA5:def 3; then
      ['r1,c'] c= ].a,c.] by A19,XXREAL_1:39; then
A25:   ['r1,c'] c= dom f by A2;
      b in ['r1,c'] by A24,A20,A1,XXREAL_1:1; then
      integral(f,r1,c) = integral(f,r1,b) + integral(f,b,c)
        by A21,A23,A25,INTEGRA6:17; then
      integral(f,r1,b) = integral(f,r1,c) - integral(f,b,c); then
      g1 < integral(f,r1,c) by A22,XREAL_1:9;
      hence g1 < Intf.r1 by A13,A19;
     end;
    end;
    hence
A26:  f is_left_improper_integrable_on a,c
       by A12,A13,A14,A1,A2,A3,A4,A5,Lm11,LIMFUNC2:11;
    Intf is_right_divergent_to+infty_in a by A14,A16,LIMFUNC2:11;
    hence left_improper_integral(f,a,c) = +infty by A12,A13,A26,Def3;
end;

Lm14:
for f be PartFunc of REAL,REAL, a,b,c be Real
 st a < b <= c & ].a,c.] c= dom f & f|['b,c'] is bounded
  & f is_left_improper_integrable_on a,b & f is_integrable_on ['b,c']
  & left_improper_integral(f,a,b) = -infty
holds f is_left_improper_integrable_on a,c
  & left_improper_integral(f,a,c) = -infty
proof
    let f be PartFunc of REAL,REAL, a,b,c be Real;
    assume that
A1:  a < b <= c and
A2:  ].a,c.] c= dom f and
A3:  f|['b,c'] is bounded and
A4:  f is_left_improper_integrable_on a,b and
A5:  f is_integrable_on ['b,c'] and
A6:  left_improper_integral(f,a,b) = -infty;

    consider I be PartFunc of REAL,REAL such that
A7:  dom I = ].a,b.] and
A8:  for x be Real st x in dom I holds I.x = integral(f,x,b) and
A9:  (I is_right_convergent_in a or I is_right_divergent_to+infty_in a
     or I is_right_divergent_to-infty_in a) by A4;

    left_improper_integral(f,a,b) <> ext_left_integral(f,a,b)
      by A6; then
A10: not f is_left_ext_Riemann_integrable_on a,b by A4,Th34;

    reconsider AC = ].a,c.] as non empty Subset of REAL by A1,XXREAL_1:2;
    deffunc F(Element of AC) = In(integral(f,$1,c),REAL);
    consider Intf be Function of AC,REAL such that
A11:  for x be Element of AC holds Intf.x = F(x) from FUNCT_2:sch 4;
A12: dom Intf = AC by FUNCT_2:def 1; then
    reconsider Intf as PartFunc of REAL,REAL by RELSET_1:5;

A13: for x be Real st x in dom Intf holds Intf.x = integral(f,x,c)
    proof
     let x be Real;
     assume x in dom Intf; then
     Intf.x = In(integral(f,x,c),REAL) by A11,A12;
     hence thesis;
    end;

A14: for r be Real st a < r ex g be Real st g < r & a < g & g in dom Intf
    proof
     let r be Real;
     assume a < r; then
     consider g be Real such that
A15:   g < r & a < g & g in dom I
        by A10,A6,A7,Def3,INTEGR10:def 2,A4,LIMFUNC2:12;
     ].a,b.] c= ].a,c.] by A1,XXREAL_1:42;
     hence thesis by A15,A7,A12;
    end;

A16: for g1 be Real ex r be Real st a < r & for r1 be Real st r1 < r & a < r1 &
     r1 in dom Intf holds Intf.r1 < g1
    proof
     let g1 be Real;
     consider r be Real such that
A17:   a < r and
A18:   for r1 be Real st r1 < r & a < r1 & r1 in dom I
        holds I.r1 < g1-integral(f,b,c)
          by A10,A9,A4,A6,A7,A8,Def3,INTEGR10:def 2,LIMFUNC2:12;
     set R = min(b,r);
     take R;
     thus a < R by A1,A17,XXREAL_0:21;
     thus for r1 be Real st r1 < R & a < r1 & r1 in dom Intf holds Intf.r1 < g1
     proof
      let r1 be Real;
      assume A19: r1 < R & a < r1 & r1 in dom Intf;
      R <= b & R <= r by XXREAL_0:17; then
A20:   r1 < b & r1 < r by A19,XXREAL_0:2; then
A21:   r1 < c by A1,XXREAL_0:2; then
A22:   f is_integrable_on ['r1,c'] & f|['r1,c'] is bounded
        by A19,A1,A2,A3,A4,A5,Lm11;

      r1 in dom I by A7,A19,A20,XXREAL_1:2; then
      I.r1 < g1-integral(f,b,c) by A18,A19,A20; then
A23:   integral(f,r1,b) < g1-integral(f,b,c) by A8,A20,A7,A19,XXREAL_1:2;

A24:   ['r1,c'] = [.r1,c.] by A20,A1,XXREAL_0:2,INTEGRA5:def 3; then
      ['r1,c'] c= ].a,c.] by A19,XXREAL_1:39; then
A25:   ['r1,c'] c= dom f by A2;
      b in ['r1,c'] by A24,A20,A1,XXREAL_1:1; then
      integral(f,r1,c) = integral(f,r1,b) + integral(f,b,c)
        by A21,A22,A25,INTEGRA6:17; then
      integral(f,r1,b) = integral(f,r1,c) - integral(f,b,c); then
      integral(f,r1,c) < g1 by A23,XREAL_1:9;
      hence Intf.r1 < g1 by A13,A19;
     end;
    end;
    hence
A26:  f is_left_improper_integrable_on a,c
       by A12,A13,A14,A1,A2,A3,A4,A5,Lm11,LIMFUNC2:12;
    Intf is_right_divergent_to-infty_in a by A14,A16,LIMFUNC2:12;
    hence left_improper_integral(f,a,c) = -infty by A12,A13,A26,Def3;
end;

theorem Th38:
for f be PartFunc of REAL,REAL, a,b,c be Real
 st a < b <= c & ].a,c.] c= dom f & f|['b,c'] is bounded
  & f is_left_improper_integrable_on a,b & f is_integrable_on ['b,c']
holds f is_left_improper_integrable_on a,c &
  ( left_improper_integral(f,a,b) = ext_left_integral(f,a,b) implies
     left_improper_integral(f,a,c)
     = left_improper_integral(f,a,b) + integral(f,b,c) ) &
  ( left_improper_integral(f,a,b) = +infty implies
     left_improper_integral(f,a,c) = +infty ) &
  ( left_improper_integral(f,a,b) = -infty implies
     left_improper_integral(f,a,c) = -infty )
proof
    let f be PartFunc of REAL,REAL, a,b,c be Real;
    assume that
A1:  a < b <= c and
A2:  ].a,c.] c= dom f and
A3:  f|['b,c'] is bounded and
A4:  f is_left_improper_integrable_on a,b and
A5:  f is_integrable_on ['b,c'];
    per cases;
    suppose f is_left_ext_Riemann_integrable_on a,b; then
     left_improper_integral(f,a,b) = ext_left_integral(f,a,b) by A4,Th34;
     hence thesis by A1,A2,A3,A4,A5,Lm12;
    end;
    suppose not f is_left_ext_Riemann_integrable_on a,b; then
     per cases by A4,Th34;
     suppose left_improper_integral(f,a,b) = +infty;
      hence thesis by A1,A2,A3,A4,A5,Lm13;
     end;
     suppose left_improper_integral(f,a,b) = -infty;
      hence thesis by A1,A2,A3,A4,A5,Lm14;
     end;
    end;
end;

theorem Th39:
for f be PartFunc of REAL,REAL, a,b be Real st
 f is_right_improper_integrable_on a,b holds
   (f is_right_ext_Riemann_integrable_on a,b &
    right_improper_integral(f,a,b) = ext_right_integral(f,a,b))
or (not f is_right_ext_Riemann_integrable_on a,b &
    right_improper_integral(f,a,b) = +infty)
or (not f is_right_ext_Riemann_integrable_on a,b &
    right_improper_integral(f,a,b) = -infty)
proof
    let f be PartFunc of REAL,REAL, a,b be Real;
    assume
A1:  f is_right_improper_integrable_on a,b; then
    consider Intf be PartFunc of REAL,REAL such that
A2:  dom Intf = [.a,b.[ &
     (for x be Real st x in dom Intf holds Intf.x = integral(f,a,x)) &
     (Intf is_left_convergent_in b or Intf is_left_divergent_to+infty_in b
     or Intf is_left_divergent_to-infty_in b);
    per cases by A2;
    suppose A3: Intf is_left_convergent_in b; then
A4:  f is_right_ext_Riemann_integrable_on a,b by A1,A2,INTEGR10:def 1;
     right_improper_integral(f,a,b) = lim_left(Intf,b) by A1,A2,A3,Def4
      .= ext_right_integral(f,a,b) by A2,A3,A4,INTEGR10:def 3;
     hence thesis by A3,A1,A2,INTEGR10:def 1;
    end;
    suppose A5: Intf is_left_divergent_to+infty_in b;
     for I be PartFunc of REAL,REAL st
      dom I = [.a,b.[
    & (for x be Real st x in dom I holds I.x = integral(f,a,x))
      holds not I is_left_convergent_in b
     proof
      let I be PartFunc of REAL,REAL;
      assume that
A6:    dom I = [.a,b.[ and
A7:    for x be Real st x in dom I holds I.x = integral(f,a,x);

      now let x be Element of REAL;
       assume A8: x in dom Intf; then
       Intf.x = integral(f,a,x) by A2;
       hence Intf.x = I.x by A2,A6,A7,A8;
      end; then
      Intf = I by A2,A6,PARTFUN1:5;
      hence not I is_left_convergent_in b by A5,Th6;
     end;
     hence thesis by A1,Def4,INTEGR10:def 1;
    end;
    suppose A9: Intf is_left_divergent_to-infty_in b;
     for I be PartFunc of REAL,REAL st
      dom I = [.a,b.[
    & (for x be Real st x in dom I holds I.x = integral(f,a,x))
      holds not I is_left_convergent_in b
     proof
      let I be PartFunc of REAL,REAL;
      assume that
A10:   dom I = [.a,b.[ and
A11:   for x be Real st x in dom I holds I.x = integral(f,a,x);
      now let x be Element of REAL;
       assume A12: x in dom Intf; then
       Intf.x = integral(f,a,x) by A2;
       hence Intf.x = I.x by A2,A10,A11,A12;
      end; then
      Intf = I by A2,A10,PARTFUN1:5;
      hence not I is_left_convergent_in b by A9,Th7;
     end;
     hence thesis by A1,Def4,INTEGR10:def 1;
    end;
end;

theorem Th40:
for f be PartFunc of REAL,REAL, a,b be Real st
  ex Intf be PartFunc of REAL,REAL st dom Intf = [.a,b.[ &
   (for x be Real st x in dom Intf holds Intf.x = integral(f,a,x)) &
    (Intf is_left_divergent_to+infty_in b or
     Intf is_left_divergent_to-infty_in b)
 holds not f is_right_ext_Riemann_integrable_on a,b
proof
    let f be PartFunc of REAL,REAL, a,b be Real;
    assume ex Intf be PartFunc of REAL,REAL st dom Intf = [.a,b.[ &
     (for x be Real st x in dom Intf holds Intf.x = integral(f,a,x)) &
     (Intf is_left_divergent_to+infty_in b or
       Intf is_left_divergent_to-infty_in b); then
    consider Intf be PartFunc of REAL,REAL such that
A1:     dom Intf = [.a,b.[ and
A2:  for x be Real st x in dom Intf holds Intf.x = integral(f,a,x) and
A3:  Intf is_left_divergent_to+infty_in b
    or Intf is_left_divergent_to-infty_in b;

    hereby assume f is_right_ext_Riemann_integrable_on a,b; then
     consider I be PartFunc of REAL,REAL such that
A4:   dom I = [.a,b.[ and
A5:   for x be Real st x in dom I holds I.x = integral(f,a,x) and
A6:   I is_left_convergent_in b by INTEGR10:def 1;
     now let x be Element of REAL;
      assume A7: x in dom I; then
      I.x = integral(f,a,x) by A5;
      hence I.x = Intf.x by A1,A4,A7,A2;
     end; then
     I = Intf by A1,A4,PARTFUN1:5;
     hence contradiction by A3,A6,Th6,Th7;
    end;
end;

theorem
for f,Intf be PartFunc of REAL,REAL, a,b be Real st
 f is_right_improper_integrable_on a,b &
 dom Intf = [.a,b.[ &
 (for x be Real st x in dom Intf holds Intf.x = integral(f,a,x)) &
 Intf is_left_convergent_in b
holds right_improper_integral(f,a,b) = lim_left(Intf,b)
proof
    let f,Intf be PartFunc of REAL,REAL, a,b be Real;
    assume that
A1:  f is_right_improper_integrable_on a,b and
A2:  dom Intf = [.a,b.[ and
A3:  for x be Real st x in dom Intf holds Intf.x = integral(f,a,x) and
A4:  Intf is_left_convergent_in b;

A5: f is_right_ext_Riemann_integrable_on a,b by A1,A2,A3,A4,INTEGR10:def 1;
    then
A6: right_improper_integral(f,a,b) = ext_right_integral(f,a,b) by A1,Th39;

    consider I be PartFunc of REAL,REAL such that
A7:  dom I = [.a,b.[ and
A8:  for x be Real st x in dom I holds I.x = integral(f,a,x) and
     I is_left_convergent_in b and
A9:  ext_right_integral(f,a,b) = lim_left(I,b) by A5,INTEGR10:def 3;

    now let x be Element of REAL;
     assume A10: x in dom Intf; then
     Intf.x = integral(f,a,x) by A3;
     hence Intf.x = I.x by A2,A7,A8,A10;
    end;
    hence right_improper_integral(f,a,b) = lim_left(Intf,b)
      by A6,A9,A2,A7,PARTFUN1:5;
end;

Lm15:
for f be PartFunc of REAL,REAL, a,c be Real st
  [.a,c.[ c= dom f & f is_right_improper_integrable_on a,c holds
for b be Real st a <= b < c holds
 for d be Real st b <= d & d < c holds
     f is_integrable_on ['b,d'] & f|['b,d'] is bounded
proof
    let f be PartFunc of REAL,REAL, a,c be Real;
    assume that
A1:  [.a,c.[ c= dom f and
A2:  f is_right_improper_integrable_on a,c;
    let b be Real;
    assume
A3:  a <= b < c;
    thus for d be Real st b <= d & d < c holds
     f is_integrable_on ['b,d'] & f|['b,d'] is bounded
    proof
     let d be Real;
     assume A4: b <= d & d < c; then
A5:  a <= d & d < c by A3,XXREAL_0:2; then
A6:  f is_integrable_on ['a,d'] & f|['a,d'] is bounded by A2;
A7:  [.a,d.] = ['a,d'] by A4,A3,XXREAL_0:2,INTEGRA5:def 3; then
     ['a,d'] c= [.a,c.[ by A4,XXREAL_1:43; then
A8:  ['a,d'] c= dom f by A1;
     b in ['a,d'] by A7,A4,A3,XXREAL_1:1;
     hence f is_integrable_on ['b,d'] by A6,A5,A8,INTEGRA6:17;
     [.b,d.] = ['b,d'] by A4,INTEGRA5:def 3;
     hence f|['b,d'] is bounded by A6,A3,A7,XXREAL_1:34,RFUNCT_1:74;
    end;
end;

Lm16:
for f be PartFunc of REAL,REAL, a,c be Real st
  [.a,c.[ c= dom f & f is_right_improper_integrable_on a,c
& right_improper_integral(f,a,c) = ext_right_integral(f,a,c) holds
 for b be Real st a <= b < c holds
  f is_right_improper_integrable_on b,c
& right_improper_integral(f,b,c) = ext_right_integral(f,b,c)
proof
    let f be PartFunc of REAL,REAL, a,c be Real;
    assume that
A1:  [.a,c.[ c= dom f and
A2:  f is_right_improper_integrable_on a,c and
A3:  right_improper_integral(f,a,c) = ext_right_integral(f,a,c);
    let b be Real;
    assume
A4:  a <= b < c;

A5: for d be Real st b <= d & d < c holds
     f is_integrable_on ['b,d'] & f|['b,d'] is bounded by A1,A2,A4,Lm15;

    consider I be PartFunc of REAL,REAL such that
A6:  dom I = [.a,c.[ and
A7:  for x be Real st x in dom I holds I.x = integral(f,a,x) and
A8:  (I is_left_convergent_in c or I is_left_divergent_to+infty_in c
     or I is_left_divergent_to-infty_in c) by A2;

A9: now assume I is_left_divergent_to+infty_in c; then
     not f is_right_ext_Riemann_integrable_on a,c by A6,A7,Th40;
     hence contradiction by A2,A3,Th39;
    end;

A10: now assume I is_left_divergent_to-infty_in c; then
     not f is_right_ext_Riemann_integrable_on a,c by A6,A7,Th40;
     hence contradiction by A2,A3,Th39;
    end;

    reconsider BC = [.b,c.[ as non empty Subset of REAL by A4,XXREAL_1:3;
    deffunc F(Element of BC) = In(integral(f,b,$1),REAL);
    consider Intf be Function of BC,REAL such that
A11:  for x be Element of BC holds Intf.x = F(x) from FUNCT_2:sch 4;
A12: dom Intf = BC by FUNCT_2:def 1; then
    reconsider Intf as PartFunc of REAL,REAL by RELSET_1:5;

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 A11,A12;
     hence thesis;
    end;

A14: for r be Real st r < c ex g be Real st r < g & g < c & g in dom Intf
    proof
     let r be Real;
     assume
A15:   r < c;
     set R = max(b,r);
     consider g be Real such that
A16:   R < g & g < c & g in dom I by A8,A9,A10,A15,A4,XXREAL_0:29,LIMFUNC2:7;
     b <= R & r <= R by XXREAL_0:25; then
A17:  b< g  & r < g by A16,XXREAL_0:2; then
     g in [.b,c.[ by A16,XXREAL_1:3;
     hence thesis by A12,A17,A16;
    end;

    consider g be Real such that
A18:  for g1 be Real st 0 < g1
      ex r be Real st r < c & for r1 be Real st r < r1 & r1 < c & r1 in dom I
        holds |. I.r1-g .| < g1 by A8,A9,A10,LIMFUNC2:7;
    set G = g-integral(f,a,b);

A19: for g1 be Real st 0 <g1
     ex r be Real st r < c
      & for r1 be Real st r < r1 & r1 < c & r1 in dom Intf holds
        |. Intf.r1-G .| < g1
    proof
     let g1 be Real;
     assume 0 < g1; then
     consider r be Real such that
A20:   r < c and
A21:   for r1 be Real st r < r1 & r1 < c & r1 in dom I holds |. I.r1-g .| < g1
        by A18;
     set R = max(b,r);
     for r1 be Real st R < r1 & r1 < c & r1 in dom Intf holds
      |. Intf.r1-G .| < g1
     proof
      let r1 be Real;
      assume that
A22:   R < r1 and
A23:   r1 < c and
A24:   r1 in dom Intf;
      r <= R & b <= R by XXREAL_0:25; then
A25:  r < r1 & b < r1 by A22,XXREAL_0:2;
A26: dom Intf c= dom I by A4,A6,A12,XXREAL_1:38; then
A27:  |. I.r1 - g .| < g1 by A25,A23,A21,A24;

A28:   a <= r1 by A6,A24,A26,XXREAL_1:3; then
A29:   f is_integrable_on ['a,r1'] & f|['a,r1'] is bounded by A2,A23;
A30:   [.a,r1.] = ['a,r1'] by A28,INTEGRA5:def 3; then
      ['a,r1'] c= [.a,c.[ by A23,XXREAL_1:43; then
A31:   ['a,r1'] c= dom f by A1;
A32:   b in ['a,r1'] by A25,A4,A30,XXREAL_1:1;

      I.r1 - g = integral(f,a,r1) - g by A7,A24,A26
       .= integral(f,a,b)+integral(f,b,r1) - g by A28,A29,A31,A32,INTEGRA6:17
       .= integral(f,b,r1) - (g - integral(f,a,b));
      hence |. Intf.r1 - G .| < g1 by A24,A27,A13;
     end;
     hence thesis by A20,A4,XXREAL_0:29;
    end;
    hence A33: f is_right_improper_integrable_on b,c
      by A12,A13,A14,A1,A2,A4,Lm15,LIMFUNC2:7;
    f is_right_ext_Riemann_integrable_on b,c
      by A5,A12,A13,A14,A19,LIMFUNC2:7,INTEGR10:def 1;
    hence right_improper_integral(f,b,c) = ext_right_integral(f,b,c)
      by A33,Th39;
end;

Lm17:
for f be PartFunc of REAL,REAL, a,c be Real st
  [.a,c.[ c= dom f & f is_right_improper_integrable_on a,c
& right_improper_integral(f,a,c) = +infty holds
for b be Real st a <= b < c holds
  f is_right_improper_integrable_on b,c
  & right_improper_integral(f,b,c) = +infty
proof
    let f be PartFunc of REAL,REAL, a,c be Real;
    assume that
A1:  [.a,c.[ c= dom f and
A2:  f is_right_improper_integrable_on a,c and
A3:  right_improper_integral(f,a,c) = +infty;
    let b be Real;
    assume
A4:  a <= b < c;

    consider I be PartFunc of REAL,REAL such that
A5:  dom I = [.a,c.[ and
A6:  for x be Real st x in dom I holds I.x = integral(f,a,x) and
A7:  (I is_left_convergent_in c or I is_left_divergent_to+infty_in c
     or I is_left_divergent_to-infty_in c) by A2;
    right_improper_integral(f,a,c) <> ext_right_integral(f,a,c)
      by A3; then
A8: not f is_right_ext_Riemann_integrable_on a,c by A2,Th39;

    reconsider BC = [.b,c.[ as non empty Subset of REAL by A4,XXREAL_1:3;
    deffunc F(Element of BC) = In(integral(f,b,$1),REAL);
    consider Intf be Function of BC,REAL such that
A9:  for x be Element of BC holds Intf.x = F(x) from FUNCT_2:sch 4;
A10: dom Intf = BC by FUNCT_2:def 1; then
    reconsider Intf as PartFunc of REAL,REAL by RELSET_1:5;

A11: 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 A9,A10;
     hence thesis;
    end;

A12: for r be Real st r < c ex g be Real st r < g & g < c & g in dom Intf
    proof
     let r be Real;
     assume A13: r < c;
     set R = max(b,r);
     consider g be Real such that
A14:   R < g & g < c & g in dom I
       by A8,A3,A2,A5,Def4,INTEGR10:def 1,A4,A13,XXREAL_0:29,LIMFUNC2:8;
     b <= R & r <= R by XXREAL_0:25; then
A15:  b < g & r < g by A14,XXREAL_0:2; then
     g in dom Intf by A14,A10,XXREAL_1:3;
     hence thesis by A14,A15;
    end;

A16: for g1 be Real ex r be Real st r < c & for r1 be Real st r < r1 & r1 < c &
     r1 in dom Intf holds g1 < Intf.r1
    proof
     let g1 be Real;
     consider r be Real such that
A17:   r < c and
A18:   for r1 be Real st r < r1 & r1 < c & r1 in dom I
        holds g1+integral(f,a,b) < I.r1
          by A8,A7,A3,A2,A5,A6,Def4,INTEGR10:def 1,LIMFUNC2:8;
     set R = max(b,r);
     take R;
     thus R < c by A4,A17,XXREAL_0:29;
     thus for r1 be Real st R < r1 & r1 < c & r1 in dom Intf holds g1 < Intf.r1
     proof
      let r1 be Real;
      assume A19: R < r1 & r1 < c & r1 in dom Intf;
      b <= R & r <= R by XXREAL_0:25; then
A20:   b < r1 & r < r1 by A19,XXREAL_0:2; then
A21:   a < r1 by A4,XXREAL_0:2; then
      r1 in dom I by A5,A19,XXREAL_1:3; then
      g1+integral(f,a,b) < I.r1 by A18,A19,A20; then
A22:   g1 + integral(f,a,b) < integral(f,a,r1) by A6,A21,A5,A19,XXREAL_1:3;

A23:   f is_integrable_on ['a,r1'] & f|['a,r1'] is bounded by A19,A21,A2;
A24:   ['a,r1'] = [.a,r1.] by A20,A4,XXREAL_0:2,INTEGRA5:def 3; then
      ['a,r1'] c= [.a,c.[ by A19,XXREAL_1:43; then
A25:   ['a,r1'] c= dom f by A1;
      b in ['a,r1'] by A24,A20,A4,XXREAL_1:1; then
      integral(f,a,r1) = integral(f,a,b) + integral(f,b,r1)
        by A21,A23,A25,INTEGRA6:17; then
      g1 < integral(f,b,r1) by A22,XREAL_1:6;
      hence g1 < Intf.r1 by A11,A19;
     end;
    end;
    hence
A26:  f is_right_improper_integrable_on b,c
      by A10,A11,A1,A2,A4,Lm15,A12,LIMFUNC2:8;
    Intf is_left_divergent_to+infty_in c by A12,A16,LIMFUNC2:8;
    hence right_improper_integral(f,b,c) = +infty by A10,A11,A26,Def4;
end;

Lm18:
for f be PartFunc of REAL,REAL, a,c be Real st
  [.a,c.[ c= dom f & f is_right_improper_integrable_on a,c
& right_improper_integral(f,a,c) = -infty holds
for b be Real st a <= b < c holds
  f is_right_improper_integrable_on b,c
  & right_improper_integral(f,b,c) = -infty
proof
    let f be PartFunc of REAL,REAL, a,c be Real;
    assume that
A1:  [.a,c.[ c= dom f and
A2:  f is_right_improper_integrable_on a,c and
A3:  right_improper_integral(f,a,c) = -infty;
    let b be Real;
    assume
A4:  a <= b < c;

    consider I be PartFunc of REAL,REAL such that
A5:  dom I = [.a,c.[ and
A6:  for x be Real st x in dom I holds I.x = integral(f,a,x) and
A7:  (I is_left_convergent_in c or I is_left_divergent_to+infty_in c
     or I is_left_divergent_to-infty_in c) by A2;
    right_improper_integral(f,a,c) <> ext_right_integral(f,a,c)
      by A3; then
A8: not f is_right_ext_Riemann_integrable_on a,c by A2,Th39;

    reconsider BC = [.b,c.[ as non empty Subset of REAL by A4,XXREAL_1:3;
    deffunc F(Element of BC) = In(integral(f,b,$1),REAL);
    consider Intf be Function of BC,REAL such that
A9:  for x be Element of BC holds Intf.x = F(x) from FUNCT_2:sch 4;
A10: dom Intf = BC by FUNCT_2:def 1; then
    reconsider Intf as PartFunc of REAL,REAL by RELSET_1:5;

A11: 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 A9,A10;
     hence thesis;
    end;

A12: for r be Real st r < c ex g be Real st r < g & g < c & g in dom Intf
    proof
     let r be Real;
     assume A13: r < c;
     set R = max(b,r);
     consider g be Real such that
A14:   R < g & g < c & g in dom I
       by A8,A3,A2,A5,Def4,INTEGR10:def 1,A4,A13,XXREAL_0:29,LIMFUNC2:9;
     b <= R & r <= R by XXREAL_0:25; then
A15:  b < g & r < g by A14,XXREAL_0:2; then
     g in dom Intf by A14,A10,XXREAL_1:3;
     hence thesis by A14,A15;
    end;

A16: for g1 be Real ex r be Real st r < c & for r1 be Real st r < r1 & r1 < c &
     r1 in dom Intf holds Intf.r1 < g1
    proof
     let g1 be Real;
     consider r be Real such that
A17:   r < c and
A18:   for r1 be Real st r < r1 & r1 < c & r1 in dom I
        holds I.r1 < g1+integral(f,a,b)
          by A8,A7,A3,A2,A5,A6,Def4,INTEGR10:def 1,LIMFUNC2:9;
     set R = max(b,r);
     take R;
     thus R < c by A4,A17,XXREAL_0:29;
     thus for r1 be Real st R < r1 & r1 < c & r1 in dom Intf holds Intf.r1 < g1
     proof
      let r1 be Real;
      assume A19: R < r1 & r1 < c & r1 in dom Intf;
      b <= R & r <= R by XXREAL_0:25; then
A20:   b < r1 & r < r1 by A19,XXREAL_0:2; then
A21:   a < r1 by A4,XXREAL_0:2; then
      r1 in dom I by A5,A19,XXREAL_1:3; then
      I.r1 < g1+integral(f,a,b) by A18,A19,A20; then
A22:   integral(f,a,r1) < g1 + integral(f,a,b) by A6,A21,A5,A19,XXREAL_1:3;

A23:   f is_integrable_on ['a,r1'] & f|['a,r1'] is bounded by A19,A21,A2;
A24:   ['a,r1'] = [.a,r1.] by A20,A4,XXREAL_0:2,INTEGRA5:def 3; then
      ['a,r1'] c= [.a,c.[ by A19,XXREAL_1:43; then
A25:   ['a,r1'] c= dom f by A1;
      b in ['a,r1'] by A24,A20,A4,XXREAL_1:1; then
      integral(f,a,r1) = integral(f,a,b) + integral(f,b,r1)
        by A21,A23,A25,INTEGRA6:17; then
      integral(f,b,r1) < g1 by A22,XREAL_1:6;
      hence Intf.r1 < g1 by A11,A19;
     end;
    end;
    hence
A26:  f is_right_improper_integrable_on b,c
      by A10,A11,A1,A2,A4,Lm15,A12,LIMFUNC2:9;
    Intf is_left_divergent_to-infty_in c by A12,A16,LIMFUNC2:9;
    hence right_improper_integral(f,b,c) = -infty by A10,A11,A26,Def4;
end;

theorem Th42:
for f be PartFunc of REAL,REAL, a,b,c be Real st a <= b < c & [.a,c.[ c= dom f
 & f is_right_improper_integrable_on a,c holds
  f is_right_improper_integrable_on b,c &
  ( right_improper_integral(f,a,c) = ext_right_integral(f,a,c)
     implies right_improper_integral(f,b,c) = ext_right_integral(f,b,c) ) &
  ( right_improper_integral(f,a,c) = +infty
     implies right_improper_integral(f,b,c) = +infty ) &
  ( right_improper_integral(f,a,c) = -infty
     implies right_improper_integral(f,b,c) = -infty )
proof
    let f be PartFunc of REAL,REAL, a,b,c be Real;
    assume that
A1:  a <= b < c and
A2:  [.a,c.[ c= dom f and
A3:  f is_right_improper_integrable_on a,c;

    per cases;
    suppose f is_right_ext_Riemann_integrable_on a,c; then
     right_improper_integral(f,a,c) = ext_right_integral(f,a,c) by A3,Th39;
     hence thesis by A1,A2,A3,Lm16;
    end;
    suppose not f is_right_ext_Riemann_integrable_on a,c; then
     per cases by A3,Th39;
     suppose right_improper_integral(f,a,c) = +infty;
      hence thesis by A1,A2,A3,Lm17;
     end;
     suppose right_improper_integral(f,a,c) = -infty;
      hence thesis by A1,A2,A3,Lm18;
     end;
    end;
end;

Lm19:
for f be PartFunc of REAL,REAL, a,b,c be Real
 st a <= b < c & [.a,c.[ c= dom f & f|['a,b'] is bounded
  & f is_right_improper_integrable_on b,c & f is_integrable_on ['a,b']
holds for d be Real st a <= d & d < c holds
        f is_integrable_on ['a,d'] & f|['a,d'] is bounded
proof
    let f be PartFunc of REAL,REAL, a,b,c be Real;
    assume that
A1:  a <= b < c and
A2:  [.a,c.[ c= dom f and
A3:  f|['a,b'] is bounded and
A4:  f is_right_improper_integrable_on b,c and
A5:  f is_integrable_on ['a,b'];

    hereby let d be Real;
     assume
A6:   a <= d & d < c; then
     ['a,d'] = [.a,d.] by INTEGRA5:def 3; then
     ['a,d'] c= [.a,c.[ by A6,XXREAL_1:43; then
A7:  ['a,d'] c= dom f by A2;

A8: ['a,b'] = [.a,b.] & ['a,d'] = [.a,d.] by A1,A6,INTEGRA5:def 3;

     per cases;
     suppose A9: d > b; then
A10:  f is_integrable_on ['b,d'] & f|['b,d'] is bounded by A4,A6;
      hence f is_integrable_on ['a,d'] by A9,A1,A7,A3,A5,Th1;
      ['b,d'] = [.b,d.] by A9,INTEGRA5:def 3; then
      ['a,b'] \/ ['b,d'] = [.a,d.] by A9,A1,A8,XXREAL_1:165;
      hence f|['a,d'] is bounded by A10,A3,A8,RFUNCT_1:87;
     end;
     suppose A11: b >= d;
      [.a,b.] c= [.a,c.[ by A1,XXREAL_1:43; then
A12:  ['a,b'] c= dom f by A2,A8;
      d in ['a,b'] by A8,A11,A6,XXREAL_1:1;
      hence f is_integrable_on ['a,d'] by A1,A3,A5,A12,INTEGRA6:17;
      thus f|['a,d'] is bounded by A3,A11,A8,XXREAL_1:34,RFUNCT_1:74;
     end;
    end;
end;

Lm20:
for f be PartFunc of REAL,REAL, a,b,c be Real
 st a <= b < c & [.a,c.[ c= dom f & f|['a,b'] is bounded
  & f is_right_improper_integrable_on b,c & f is_integrable_on ['a,b']
  & right_improper_integral(f,b,c) = ext_right_integral(f,b,c)
holds f is_right_improper_integrable_on a,c
  & right_improper_integral(f,a,c)
     = right_improper_integral(f,b,c) + integral(f,a,b)
proof
    let f be PartFunc of REAL,REAL, a,b,c be Real;
    assume that
A1:  a <= b < c and
A2:  [.a,c.[ c= dom f and
A3:  f|['a,b'] is bounded and
A4:  f is_right_improper_integrable_on b,c and
A5:  f is_integrable_on ['a,b'] and
A6:  right_improper_integral(f,b,c) = ext_right_integral(f,b,c);

    consider I be PartFunc of REAL,REAL such that
A7:  dom I = [.b,c.[ and
A8:  for x be Real st x in dom I holds I.x = integral(f,b,x) and
A9:  (I is_left_convergent_in c or I is_left_divergent_to+infty_in c
     or I is_left_divergent_to-infty_in c) by A4;

A10: now assume I is_left_divergent_to+infty_in c; then
     not f is_right_ext_Riemann_integrable_on b,c by A7,A8,Th40;
     hence contradiction by A4,A6,Th39;
    end;

    now assume I is_left_divergent_to-infty_in c; then
     not f is_right_ext_Riemann_integrable_on b,c by A7,A8,Th40;
     hence contradiction by A4,A6,Th39;
    end; then
    f is_right_ext_Riemann_integrable_on b,c
      by A4,A7,A8,A9,A10,INTEGR10:def 1; then
A11: f is_right_ext_Riemann_integrable_on a,c
  & ext_right_integral(f,a,c) = ext_right_integral(f,b,c) + integral(f,a,b)
      by A1,A2,A3,A5,Th21;

    ex Intf be PartFunc of REAL,REAL st dom Intf = [.a,c.[ &
     (for x be Real st x in dom Intf holds Intf.x = integral(f,a,x)) &
     Intf is_left_convergent_in c by A11,INTEGR10:def 1;
    hence f is_right_improper_integrable_on a,c
      by A1,A2,A3,A4,A5,Lm19; then
    right_improper_integral(f,a,c)
      = ext_right_integral(f,b,c) + integral(f,a,b) by A11,Th39;
    hence right_improper_integral(f,a,c)
         = right_improper_integral(f,b,c) + integral(f,a,b)
           by A6,XXREAL_3:def 2;
end;

Lm21:
for f be PartFunc of REAL,REAL, a,b,c be Real
 st a <= b < c & [.a,c.[ c= dom f & f|['a,b'] is bounded
  & f is_right_improper_integrable_on b,c & f is_integrable_on ['a,b']
  & right_improper_integral(f,b,c) = +infty
holds f is_right_improper_integrable_on a,c
  & right_improper_integral(f,a,c) = +infty
proof
    let f be PartFunc of REAL,REAL, a,b,c be Real;
    assume that
A1:  a <= b < c and
A2:  [.a,c.[ c= dom f and
A3:  f|['a,b'] is bounded and
A4:  f is_right_improper_integrable_on b,c and
A5:  f is_integrable_on ['a,b'] and
A6:  right_improper_integral(f,b,c) = +infty;

    consider I be PartFunc of REAL,REAL such that
A7:  dom I = [.b,c.[ and
A8:  for x be Real st x in dom I holds I.x = integral(f,b,x) and
A9:  (I is_left_convergent_in c or I is_left_divergent_to+infty_in c
     or I is_left_divergent_to-infty_in c) by A4;

    right_improper_integral(f,b,c) <> ext_right_integral(f,b,c)
      by A6; then
A10: not f is_right_ext_Riemann_integrable_on b,c by A4,Th39;

    reconsider AC = [.a,c.[ as non empty Subset of REAL by A1,XXREAL_1:3;
    deffunc F(Element of AC) = In(integral(f,a,$1),REAL);
    consider Intf be Function of AC,REAL such that
A11:  for x be Element of AC holds Intf.x = F(x) from FUNCT_2:sch 4;
A12: dom Intf = AC by FUNCT_2:def 1; then
    reconsider Intf as PartFunc of REAL,REAL by RELSET_1:5;

A13: for x be Real st x in dom Intf holds Intf.x = integral(f,a,x)
    proof
     let x be Real;
     assume x in dom Intf; then
     Intf.x = In(integral(f,a,x),REAL) by A11,A12;
     hence thesis;
    end;

A14: for r be Real st r < c ex g be Real st r < g & g < c & g in dom Intf
    proof
     let r be Real;
     assume  r < c; then
     consider g be Real such that
A15:   r < g & g < c & g in dom I
        by A10,A6,A7,Def4,INTEGR10:def 1,A4,LIMFUNC2:8;
     [.b,c.[ c= [.a,c.[ by A1,XXREAL_1:38;
     hence thesis by A15,A7,A12;
    end;

A16: for g1 be Real ex r be Real st r < c & for r1 be Real st r < r1 & r1 < c &
     r1 in dom Intf holds g1 < Intf.r1
    proof
     let g1 be Real;
     consider r be Real such that
A17:   r < c and
A18:   for r1 be Real st r < r1 & r1 < c & r1 in dom I
        holds g1-integral(f,a,b) < I.r1
          by A10,A9,A4,A6,A7,A8,Def4,INTEGR10:def 1,LIMFUNC2:8;
     set R = max(b,r);
     take R;
     thus R < c by A1,A17,XXREAL_0:29;
     thus for r1 be Real st R < r1 & r1 < c & r1 in dom Intf holds g1 < Intf.r1
     proof
      let r1 be Real;
      assume A19: R < r1 & r1 < c & r1 in dom Intf;
      b <= R & r <= R by XXREAL_0:25; then
A20:   b < r1 & r < r1 by A19,XXREAL_0:2; then
A21:   a < r1 by A1,XXREAL_0:2;

      r1 in dom I by A7,A19,A20,XXREAL_1:3; then
      g1-integral(f,a,b) < I.r1 by A18,A19,A20; then
A22:   g1-integral(f,a,b) < integral(f,b,r1) by A8,A20,A7,A19,XXREAL_1:3;

A23:   f is_integrable_on ['a,r1'] & f|['a,r1'] is bounded
        by A19,A21,A1,A2,A3,A4,A5,Lm19;
A24:   ['a,r1'] = [.a,r1.] by A20,A1,XXREAL_0:2,INTEGRA5:def 3; then
      ['a,r1'] c= [.a,c.[ by A19,XXREAL_1:43; then
A25:   ['a,r1'] c= dom f by A2;
      b in ['a,r1'] by A24,A20,A1,XXREAL_1:1; then
      integral(f,a,r1) = integral(f,a,b) + integral(f,b,r1)
        by A21,A23,A25,INTEGRA6:17; then
      integral(f,b,r1) = integral(f,a,r1) - integral(f,a,b); then
      g1 < integral(f,a,r1) by A22,XREAL_1:9;
      hence g1 < Intf.r1 by A13,A19;
     end;
    end;
    hence
A26:  f is_right_improper_integrable_on a,c
      by A12,A13,A14,A1,A2,A3,A4,A5,Lm19,LIMFUNC2:8;
    Intf is_left_divergent_to+infty_in c by A14,A16,LIMFUNC2:8;
    hence right_improper_integral(f,a,c) = +infty by A12,A13,A26,Def4;
end;

Lm22:
for f be PartFunc of REAL,REAL, a,b,c be Real
 st a <= b < c & [.a,c.[ c= dom f & f|['a,b'] is bounded
  & f is_right_improper_integrable_on b,c & f is_integrable_on ['a,b']
  & right_improper_integral(f,b,c) = -infty
holds f is_right_improper_integrable_on a,c
  & right_improper_integral(f,a,c) = -infty
proof
    let f be PartFunc of REAL,REAL, a,b,c be Real;
    assume that
A1:  a <= b < c and
A2:  [.a,c.[ c= dom f and
A3:  f|['a,b'] is bounded and
A4:  f is_right_improper_integrable_on b,c and
A5:  f is_integrable_on ['a,b'] and
A6:  right_improper_integral(f,b,c) = -infty;

    consider I be PartFunc of REAL,REAL such that
A7:  dom I = [.b,c.[ and
A8:  for x be Real st x in dom I holds I.x = integral(f,b,x) and
A9:  (I is_left_convergent_in c or I is_left_divergent_to+infty_in c
     or I is_left_divergent_to-infty_in c) by A4;

    right_improper_integral(f,b,c) <> ext_right_integral(f,b,c)
      by A6; then
A10: not f is_right_ext_Riemann_integrable_on b,c by A4,Th39;

    reconsider AC = [.a,c.[ as non empty Subset of REAL by A1,XXREAL_1:3;
    deffunc F(Element of AC) = In(integral(f,a,$1),REAL);
    consider Intf be Function of AC,REAL such that
A11:  for x be Element of AC holds Intf.x = F(x) from FUNCT_2:sch 4;
A12: dom Intf = AC by FUNCT_2:def 1; then
    reconsider Intf as PartFunc of REAL,REAL by RELSET_1:5;

A13: for x be Real st x in dom Intf holds Intf.x = integral(f,a,x)
    proof
     let x be Real;
     assume x in dom Intf; then
     Intf.x = In(integral(f,a,x),REAL) by A11,A12;
     hence thesis;
    end;

A14: for r be Real st r < c ex g be Real st r < g & g < c & g in dom Intf
    proof
     let r be Real;
     assume r < c; then
     consider g be Real such that
A15:   r < g & g < c & g in dom I
        by A10,A6,A7,Def4,INTEGR10:def 1,A4,LIMFUNC2:9;
     [.b,c.[ c= [.a,c.[ by A1,XXREAL_1:38;
     hence thesis by A15,A7,A12;
    end;

A16: for g1 be Real ex r be Real st r < c & for r1 be Real st r < r1 & r1 < c &
     r1 in dom Intf holds Intf.r1 < g1
    proof
     let g1 be Real;
     consider r be Real such that
A17:   r < c and
A18:   for r1 be Real st r < r1 & r1 < c & r1 in dom I
        holds I.r1 < g1-integral(f,a,b)
          by A10,A9,A4,A6,A7,A8,Def4,INTEGR10:def 1,LIMFUNC2:9;
     set R = max(b,r);
     take R;
     thus R < c by A1,A17,XXREAL_0:29;
     thus for r1 be Real st R < r1 & r1 < c & r1 in dom Intf holds Intf.r1 < g1
     proof
      let r1 be Real;
      assume A19: R < r1 & r1 < c & r1 in dom Intf;
      b <= R & r <= R by XXREAL_0:25; then
A20:   b < r1 & r < r1 by A19,XXREAL_0:2; then
A21:   a < r1 by A1,XXREAL_0:2;

      r1 in dom I by A7,A19,A20,XXREAL_1:3; then
      I.r1 < g1-integral(f,a,b) by A18,A19,A20; then
A22:   integral(f,b,r1) < g1-integral(f,a,b) by A8,A20,A7,A19,XXREAL_1:3;

A23:   f is_integrable_on ['a,r1'] & f|['a,r1'] is bounded
        by A19,A21,A1,A2,A3,A4,A5,Lm19;
A24:   ['a,r1'] = [.a,r1.] by A20,A1,XXREAL_0:2,INTEGRA5:def 3; then
      ['a,r1'] c= [.a,c.[ by A19,XXREAL_1:43; then
A25:   ['a,r1'] c= dom f by A2;
      b in ['a,r1'] by A24,A20,A1,XXREAL_1:1; then
      integral(f,a,r1) = integral(f,a,b) + integral(f,b,r1)
        by A21,A23,A25,INTEGRA6:17; then
      integral(f,b,r1) = integral(f,a,r1) - integral(f,a,b); then
      integral(f,a,r1) < g1 by A22,XREAL_1:9;
      hence Intf.r1 < g1 by A13,A19;
     end;
    end;
    hence
A26:  f is_right_improper_integrable_on a,c
       by A12,A13,A14,A1,A2,A3,A4,A5,Lm19,LIMFUNC2:9;
    Intf is_left_divergent_to-infty_in c by A14,A16,LIMFUNC2:9;
    hence right_improper_integral(f,a,c) = -infty by A12,A13,A26,Def4;
end;

theorem Th43:
for f be PartFunc of REAL,REAL, a,b,c be Real
 st a <= b < c & [.a,c.[ c= dom f & f|['a,b'] is bounded
  & f is_right_improper_integrable_on b,c & f is_integrable_on ['a,b']
holds f is_right_improper_integrable_on a,c &
  ( right_improper_integral(f,b,c) = ext_right_integral(f,b,c) implies
     right_improper_integral(f,a,c)
     = right_improper_integral(f,b,c) + integral(f,a,b) ) &
  ( right_improper_integral(f,b,c) = +infty implies
     right_improper_integral(f,a,c) = +infty ) &
  ( right_improper_integral(f,b,c) = -infty implies
     right_improper_integral(f,a,c) = -infty )
proof
    let f be PartFunc of REAL,REAL, a,b,c be Real;
    assume that
A1:  a <= b < c and
A2:  [.a,c.[ c= dom f and
A3:  f|['a,b'] is bounded and
A4:  f is_right_improper_integrable_on b,c and
A5:  f is_integrable_on ['a,b'];
    per cases;
    suppose f is_right_ext_Riemann_integrable_on b,c; then
     right_improper_integral(f,b,c) = ext_right_integral(f,b,c) by A4,Th39;
     hence thesis by A1,A2,A3,A4,A5,Lm20;
    end;
    suppose not f is_right_ext_Riemann_integrable_on b,c; then
     per cases by A4,Th39;
     suppose right_improper_integral(f,b,c) = +infty;
      hence thesis by A1,A2,A3,A4,A5,Lm21;
     end;
     suppose right_improper_integral(f,b,c) = -infty;
      hence thesis by A1,A2,A3,A4,A5,Lm22;
     end;
    end;
end;

definition
  let f be PartFunc of REAL,REAL;
  let a,c be Real;
  pred f is_improper_integrable_on a,c means
  ex b be Real st a < b < c & f is_left_improper_integrable_on a,b
   & f is_right_improper_integrable_on b,c
   & not (left_improper_integral(f,a,b) = -infty
        & right_improper_integral(f,b,c) = +infty)
   & not (left_improper_integral(f,a,b) = +infty
        & right_improper_integral(f,b,c) = -infty);
end;

theorem
for f be PartFunc of REAL,REAL, a,c be Real st
 f is_improper_integrable_on a,c holds
  ex b be Real st a < b < c &
   ( (left_improper_integral(f,a,b) = ext_left_integral(f,a,b)
    & right_improper_integral(f,b,c) = ext_right_integral(f,b,c))
 or left_improper_integral(f,a,b)+right_improper_integral(f,b,c) = +infty
 or left_improper_integral(f,a,b)+right_improper_integral(f,b,c) = -infty)
proof
    let f be PartFunc of REAL,REAL, a,c be Real;
    assume f is_improper_integrable_on a,c; then
    consider b be Real such that
A1:  a < b < c and
A2:  f is_left_improper_integrable_on a,b and
A3:  f is_right_improper_integrable_on b,c and
A4:  not(left_improper_integral(f,a,b) = -infty &
         right_improper_integral(f,b,c) = +infty) and
A5:  not(left_improper_integral(f,a,b) = +infty &
         right_improper_integral(f,b,c) = -infty);

    consider IL be PartFunc of REAL,REAL such that
A6:  dom IL = ].a,b.] and
A7:  for x be Real st x in dom IL holds IL.x = integral(f,x,b) and
A8:  IL is_right_convergent_in a or IL is_right_divergent_to+infty_in a
  or IL is_right_divergent_to-infty_in a by A2;

    consider IR be PartFunc of REAL,REAL such that
A9:  dom IR = [.b,c.[ and
A10: for x be Real st x in dom IR holds IR.x = integral(f,b,x) and
A11: IR is_left_convergent_in c or IR is_left_divergent_to+infty_in c
  or IR is_left_divergent_to-infty_in c by A3;

    per cases by A8;
    suppose IL is_right_convergent_in a; then
     f is_left_ext_Riemann_integrable_on a,b
       by A2,A6,A7,INTEGR10:def 2; then
A12: left_improper_integral(f,a,b) = ext_left_integral(f,a,b) by A2,Th34;

     per cases by A11;
     suppose IR is_left_convergent_in c; then
      f is_right_ext_Riemann_integrable_on b,c
        by A3,A9,A10,INTEGR10:def 1; then
      right_improper_integral(f,b,c) = ext_right_integral(f,b,c) by A3,Th39;
      hence thesis by A1,A12;
     end;
     suppose IR is_left_divergent_to+infty_in c; then
      right_improper_integral(f,b,c) = +infty by A3,A9,A10,Def4; then
      left_improper_integral(f,a,b)+right_improper_integral(f,b,c) = +infty
        by A12,XXREAL_3:def 2;
      hence thesis by A1;
     end;
     suppose IR is_left_divergent_to-infty_in c; then
      right_improper_integral(f,b,c) = -infty by A3,A9,A10,Def4; then
      left_improper_integral(f,a,b)+right_improper_integral(f,b,c) = -infty
        by A12,XXREAL_3:def 2;
      hence thesis by A1;
     end;
    end;
    suppose A13: IL is_right_divergent_to+infty_in a; then
A14:  left_improper_integral(f,a,b) = +infty by A2,A6,A7,Def3;

     per cases by A11,A3,A9,A10,A13,A5,A2,A6,A7,Def3,Def4;
     suppose IR is_left_convergent_in c; then
      f is_right_ext_Riemann_integrable_on b,c
        by A3,A9,A10,INTEGR10:def 1; then
      right_improper_integral(f,b,c) = ext_right_integral(f,b,c)
        by A3,Th39; then
      left_improper_integral(f,a,b)+right_improper_integral(f,b,c) = +infty
        by A14,XXREAL_3:def 2;
      hence thesis by A1;
     end;
     suppose IR is_left_divergent_to+infty_in c; then
      right_improper_integral(f,b,c) = +infty by A3,A9,A10,Def4; then
      left_improper_integral(f,a,b)+right_improper_integral(f,b,c) = +infty
        by A14,XXREAL_3:def 2;
      hence thesis by A1;
     end;
    end;
    suppose A15: IL is_right_divergent_to-infty_in a; then
A16:  left_improper_integral(f,a,b) = -infty by A2,A6,A7,Def3;

     per cases by A11,A3,A9,A10,A15,A4,A2,A6,A7,Def3,Def4;
     suppose IR is_left_convergent_in c; then
      f is_right_ext_Riemann_integrable_on b,c
        by A3,A9,A10,INTEGR10:def 1; then
      right_improper_integral(f,b,c) = ext_right_integral(f,b,c)
        by A3,Th39; then
      left_improper_integral(f,a,b)+right_improper_integral(f,b,c) = -infty
        by A16,XXREAL_3:def 2;
      hence thesis by A1;
     end;
     suppose IR is_left_divergent_to-infty_in c; then
      right_improper_integral(f,b,c) = -infty by A3,A9,A10,Def4; then
      left_improper_integral(f,a,b)+right_improper_integral(f,b,c) = -infty
        by A16,XXREAL_3:def 2;
      hence thesis by A1;
     end;
    end;
end;

theorem Th45:
for f be PartFunc of REAL,REAL, a,b,c be Real st
 ].a,c.[ c= dom f & a < b < c &
 f is_left_improper_integrable_on a,b &
 f is_right_improper_integrable_on b,c &
 not (left_improper_integral(f,a,b) = -infty
     & right_improper_integral(f,b,c) = +infty) &
 not (left_improper_integral(f,a,b) = +infty
     & right_improper_integral(f,b,c) = -infty) holds
for b1 be Real st a < b1 <= b holds
left_improper_integral(f,a,b)+right_improper_integral(f,b,c)
 = left_improper_integral(f,a,b1)+right_improper_integral(f,b1,c)
proof
    let f be PartFunc of REAL,REAL, a,b,c be Real;
    assume that
A1:  ].a,c.[ c= dom f and
A2:  a < b < c and
A3:  f is_left_improper_integrable_on a,b and
A4:  f is_right_improper_integrable_on b,c and
A5:  not (left_improper_integral(f,a,b) = -infty
     & right_improper_integral(f,b,c) = +infty) and
A6:  not (left_improper_integral(f,a,b) = +infty
     & right_improper_integral(f,b,c) = -infty);
    let b1 be Real;
    assume
A7:  a < b1 <= b;

    ].a,b.] c= ].a,c.[ & [.b,c.[ c= ].a,c.[ by A2,XXREAL_1:48,49; then
A8: ].a,b.] c= dom f & [.b,c.[ c= dom f by A1;

    [.b1,c.[ c= ].a,c.[ & [.b1,b.] c= ].a,c.[ by A7,A2,XXREAL_1:47,48; then
A9: [.b1,c.[ c= dom f & [.b1,b.] c= dom f by A1;

A10: f is_integrable_on ['b1,b'] & f|['b1,b'] is bounded by A7,A3;

    per cases by A3,Th34;
    suppose f is_left_ext_Riemann_integrable_on a,b; then
A11:  left_improper_integral(f,a,b) = ext_left_integral(f,a,b)
       by A3,Th34; then
A12:  f is_left_improper_integrable_on a,b1
   & left_improper_integral(f,a,b1) = ext_left_integral(f,a,b1)
        by A7,A8,A3,Lm8;
A13:  left_improper_integral(f,a,b)
      = left_improper_integral(f,a,b1)+integral(f,b1,b)
         by A7,A8,A10,A12,Lm12
      .= ext_left_integral(f,a,b1) +integral(f,b1,b) by A12,XXREAL_3:def 2;

     per cases by A4,Th39;
     suppose A14: f is_right_ext_Riemann_integrable_on b,c; then
A15:   right_improper_integral(f,b,c) = ext_right_integral(f,b,c)
        by A4,Th39; then
      right_improper_integral(f,b1,c)
       = right_improper_integral(f,b,c) + integral(f,b1,b)
        by A7,A2,A9,A10,A4,Lm20
      .= ext_right_integral(f,b,c) + integral(f,b1,b)
        by A15,XXREAL_3:def 2; then
      left_improper_integral(f,a,b1)+right_improper_integral(f,b1,c)
       = ext_left_integral(f,a,b1)
       + (ext_right_integral(f,b,c) + integral(f,b1,b)) by A12,XXREAL_3:def 2
      .= ext_left_integral(f,a,b1)
       + integral(f,b1,b) + ext_right_integral(f,b,c)
      .= left_improper_integral(f,a,b) + ext_right_integral(f,b,c)
         by A13,XXREAL_3:def 2;
      hence thesis by A14,A4,Th39;
     end;
     suppose A16: right_improper_integral(f,b,c) = +infty;
      right_improper_integral(f,b1,c) = +infty
        by A7,A2,A9,A10,A4,A16,Lm21; then
      left_improper_integral(f,a,b1)+right_improper_integral(f,b1,c)
       = +infty by A12,XXREAL_3:def 2;
      hence thesis by A16,A11,XXREAL_3:def 2;
     end;
     suppose A17: right_improper_integral(f,b,c) = -infty;
      right_improper_integral(f,b1,c) = -infty
        by A7,A2,A9,A10,A4,A17,Lm22; then
      left_improper_integral(f,a,b1)+right_improper_integral(f,b1,c)
       = -infty by A12,XXREAL_3:def 2;
      hence thesis by A17,A11,XXREAL_3:def 2;
     end;
    end;
    suppose A18: left_improper_integral(f,a,b) = +infty;
A19:  left_improper_integral(f,a,b1) = +infty by A8,A3,A18,A7,Lm9;

     per cases;
     suppose f is_right_ext_Riemann_integrable_on b,c; then
A20:   right_improper_integral(f,b,c) = ext_right_integral(f,b,c)
        by A4,Th39; then
      right_improper_integral(f,b1,c)
       = right_improper_integral(f,b,c) + integral(f,b1,b)
          by A7,A2,A9,A10,A4,Lm20
      .= ext_right_integral(f,b,c) + integral(f,b1,b)
        by A20,XXREAL_3:def 2; then
      left_improper_integral(f,a,b1)+right_improper_integral(f,b1,c)
       = +infty by A19,XXREAL_3:def 2;
      hence thesis by A18,A20,XXREAL_3:def 2;
     end;
     suppose not f is_right_ext_Riemann_integrable_on b,c; then
      right_improper_integral(f,b,c) = +infty by A18,A6,A4,Th39;
      hence thesis by A18,A19,A7,A2,A9,A10,A4,Lm21;
     end;
    end;
    suppose A21: left_improper_integral(f,a,b) = -infty;
A22:  left_improper_integral(f,a,b1) = -infty by A8,A3,A21,A7,Lm10;

     per cases;
     suppose f is_right_ext_Riemann_integrable_on b,c; then
A23:   right_improper_integral(f,b,c) = ext_right_integral(f,b,c)
        by A4,Th39; then
      right_improper_integral(f,b1,c)
       = right_improper_integral(f,b,c) + integral(f,b1,b)
          by A7,A2,A9,A10,A4,Lm20
      .= ext_right_integral(f,b,c) + integral(f,b1,b)
        by A23,XXREAL_3:def 2; then
      left_improper_integral(f,a,b1)+right_improper_integral(f,b1,c)
       = -infty by A22,XXREAL_3:def 2;
      hence thesis by A21,A23,XXREAL_3:def 2;
     end;
     suppose not f is_right_ext_Riemann_integrable_on b,c; then
      right_improper_integral(f,b,c) = -infty by A21,A5,A4,Th39;
      hence thesis by A21,A22,A7,A2,A9,A10,A4,Lm22;
     end;
    end;
end;

theorem Th46:
for f be PartFunc of REAL,REAL, a,b,c be Real st
 ].a,c.[ c= dom f & a < b < c &
 f is_left_improper_integrable_on a,b &
 f is_right_improper_integrable_on b,c &
 not (left_improper_integral(f,a,b) = -infty
     & right_improper_integral(f,b,c) = +infty) &
 not (left_improper_integral(f,a,b) = +infty
     & right_improper_integral(f,b,c) = -infty) holds
for b2 be Real st b <= b2 < c holds
left_improper_integral(f,a,b)+right_improper_integral(f,b,c)
 = left_improper_integral(f,a,b2)+right_improper_integral(f,b2,c)
proof
    let f be PartFunc of REAL,REAL, a,b,c be Real;
    assume that
A1:  ].a,c.[ c= dom f and
A2:  a < b < c and
A3:  f is_left_improper_integrable_on a,b and
A4:  f is_right_improper_integrable_on b,c and
A5:  not (left_improper_integral(f,a,b) = -infty
     & right_improper_integral(f,b,c) = +infty) and
A6:  not (left_improper_integral(f,a,b) = +infty
     & right_improper_integral(f,b,c) = -infty);
    let b2 be Real;
    assume
A7:  b <= b2 < c;

    ].a,b.] c= ].a,c.[ & [.b,c.[ c= ].a,c.[ by A2,XXREAL_1:48,49; then
A8: ].a,b.] c= dom f & [.b,c.[ c= dom f by A1;

    ].a,b2.] c= ].a,c.[ & [.b,b2.] c= ].a,c.[ by A7,A2,XXREAL_1:47,49; then
A9: ].a,b2.] c= dom f & [.b,b2.] c= dom f by A1;

A10: f is_integrable_on ['b,b2'] & f|['b,b2'] is bounded by A7,A4;

    per cases by A4,Th39;
    suppose f is_right_ext_Riemann_integrable_on b,c; then
A11:  right_improper_integral(f,b,c) = ext_right_integral(f,b,c)
       by A4,Th39; then
A12:  f is_right_improper_integrable_on b2,c
   & right_improper_integral(f,b2,c) = ext_right_integral(f,b2,c)
        by A7,A8,A4,Lm16;
A13:  right_improper_integral(f,b,c)
      = right_improper_integral(f,b2,c)+integral(f,b,b2)
         by A7,A8,A10,A12,Lm20
      .= ext_right_integral(f,b2,c) +integral(f,b,b2) by A12,XXREAL_3:def 2;

     per cases by A3,Th34;
     suppose A14: f is_left_ext_Riemann_integrable_on a,b; then
A15:   left_improper_integral(f,a,b) = ext_left_integral(f,a,b)
        by A3,Th34; then
      left_improper_integral(f,a,b2)
       = left_improper_integral(f,a,b) + integral(f,b,b2)
        by A7,A2,A9,A10,A3,Lm12
      .= ext_left_integral(f,a,b) + integral(f,b,b2)
        by A15,XXREAL_3:def 2; then
      right_improper_integral(f,b2,c)+left_improper_integral(f,a,b2)
       = ext_right_integral(f,b2,c)
       + (ext_left_integral(f,a,b) + integral(f,b,b2)) by A12,XXREAL_3:def 2
      .= ext_right_integral(f,b2,c)
       + integral(f,b,b2) + ext_left_integral(f,a,b)
      .= right_improper_integral(f,b,c) + ext_left_integral(f,a,b)
         by A13,XXREAL_3:def 2;
      hence thesis by A14,A3,Th34;
     end;
     suppose A16: left_improper_integral(f,a,b) = +infty;
      left_improper_integral(f,a,b2) = +infty
        by A7,A2,A9,A10,A3,A16,Lm13; then
      right_improper_integral(f,b2,c)+left_improper_integral(f,a,b2)
       = +infty by A12,XXREAL_3:def 2;
      hence thesis by A16,A11,XXREAL_3:def 2;
     end;
     suppose A17: left_improper_integral(f,a,b) = -infty;
      left_improper_integral(f,a,b2) = -infty
        by A7,A2,A9,A10,A3,A17,Lm14; then
      right_improper_integral(f,b2,c)+left_improper_integral(f,a,b2)
       = -infty by A12,XXREAL_3:def 2;
      hence thesis by A17,A11,XXREAL_3:def 2;
     end;
    end;
    suppose A18: right_improper_integral(f,b,c) = +infty;
A19:  right_improper_integral(f,b2,c) = +infty by A8,A4,A18,A7,Lm17;

     per cases;
     suppose f is_left_ext_Riemann_integrable_on a,b; then
A20:   left_improper_integral(f,a,b) = ext_left_integral(f,a,b)
        by A3,Th34; then
      left_improper_integral(f,a,b2)
       = left_improper_integral(f,a,b) + integral(f,b,b2)
          by A7,A2,A9,A10,A3,Lm12
      .= ext_left_integral(f,a,b) + integral(f,b,b2)
        by A20,XXREAL_3:def 2; then
      right_improper_integral(f,b2,c)+left_improper_integral(f,a,b2)
       = +infty by A19,XXREAL_3:def 2;
      hence thesis by A18,A20,XXREAL_3:def 2;
     end;
     suppose not f is_left_ext_Riemann_integrable_on a,b; then
      left_improper_integral(f,a,b) = +infty by A18,A5,A3,Th34;
      hence thesis by A18,A19,A7,A2,A9,A10,A3,Lm13;
     end;
    end;
    suppose A21: right_improper_integral(f,b,c) = -infty;
A22:  right_improper_integral(f,b2,c) = -infty by A8,A4,A21,A7,Lm18;

     per cases;
     suppose f is_left_ext_Riemann_integrable_on a,b; then
A23:   left_improper_integral(f,a,b) = ext_left_integral(f,a,b)
        by A3,Th34; then
      left_improper_integral(f,a,b2)
       = left_improper_integral(f,a,b) + integral(f,b,b2)
          by A7,A2,A9,A10,A3,Lm12
      .= ext_left_integral(f,a,b) + integral(f,b,b2)
        by A23,XXREAL_3:def 2; then
      right_improper_integral(f,b2,c)+left_improper_integral(f,a,b2)
       = -infty by A22,XXREAL_3:def 2;
      hence thesis by A21,A23,XXREAL_3:def 2;
     end;
     suppose not f is_left_ext_Riemann_integrable_on a,b; then
      left_improper_integral(f,a,b) = -infty by A21,A6,A3,Th34;
      hence thesis by A21,A22,A7,A2,A9,A10,A3,Lm14;
     end;
    end;
end;

theorem Th47:
for f be PartFunc of REAL,REAL, a,c be Real st
 ].a,c.[ c= dom f & f is_improper_integrable_on a,c holds
for b1,b2 be Real st a < b1 < c & a < b2 < c holds
 left_improper_integral(f,a,b1)+right_improper_integral(f,b1,c)
  = left_improper_integral(f,a,b2)+right_improper_integral(f,b2,c)
proof
    let f be PartFunc of REAL,REAL, a,c be Real;
    assume that
A1:  ].a,c.[ c= dom f and
A2:  f is_improper_integrable_on a,c;
    let b1,b2 be Real;
    assume that
A3:  a < b1 < c and
A4:  a < b2 < c;

    consider b be Real such that
A5:  a < b < c and
A6:  f is_left_improper_integrable_on a,b and
A7:  f is_right_improper_integrable_on b,c and
A8:  not (left_improper_integral(f,a,b) = -infty
       & right_improper_integral(f,b,c) = +infty) and
A9:  not (left_improper_integral(f,a,b) = +infty
       & right_improper_integral(f,b,c) = -infty) by A2;

    per cases;
    suppose b1 < b & b2 < b; then
     left_improper_integral(f,a,b)+right_improper_integral(f,b,c)
      = left_improper_integral(f,a,b1)+right_improper_integral(f,b1,c)
   & left_improper_integral(f,a,b)+right_improper_integral(f,b,c)
      = left_improper_integral(f,a,b2)+right_improper_integral(f,b2,c)
       by A1,A3,A4,A5,A6,A7,A8,A9,Th45;
     hence thesis;
    end;
    suppose b1 < b & b <= b2; then
     left_improper_integral(f,a,b)+right_improper_integral(f,b,c)
      = left_improper_integral(f,a,b1)+right_improper_integral(f,b1,c)
   & left_improper_integral(f,a,b)+right_improper_integral(f,b,c)
      = left_improper_integral(f,a,b2)+right_improper_integral(f,b2,c)
       by A1,A3,A4,A5,A6,A7,A8,A9,Th45,Th46;
     hence thesis;
    end;
    suppose b <= b1 & b2 < b; then
     left_improper_integral(f,a,b)+right_improper_integral(f,b,c)
      = left_improper_integral(f,a,b1)+right_improper_integral(f,b1,c)
   & left_improper_integral(f,a,b)+right_improper_integral(f,b,c)
      = left_improper_integral(f,a,b2)+right_improper_integral(f,b2,c)
       by A1,A3,A4,A5,A6,A7,A8,A9,Th45,Th46;
     hence thesis;
    end;
    suppose b <= b1 & b <= b2; then
     left_improper_integral(f,a,b)+right_improper_integral(f,b,c)
      = left_improper_integral(f,a,b1)+right_improper_integral(f,b1,c)
   & left_improper_integral(f,a,b)+right_improper_integral(f,b,c)
      = left_improper_integral(f,a,b2)+right_improper_integral(f,b2,c)
       by A1,A3,A4,A5,A6,A7,A8,A9,Th46;
     hence thesis;
    end;
end;

definition
  let f be PartFunc of REAL,REAL;
  let a,b be Real;
  assume
A1: ].a,b.[ c= dom f & f is_improper_integrable_on a,b;
  func improper_integral(f,a,b) -> ExtReal means
  :Def6:
   ex c be Real st a < c < b & f is_left_improper_integrable_on a,c &
    f is_right_improper_integrable_on c,b &
    it = left_improper_integral(f,a,c) + right_improper_integral(f,c,b);
existence
proof
    consider c be Real such that
A2:  a < c < b and
A3:  f is_left_improper_integrable_on a,c and
A4:  f is_right_improper_integrable_on c,b and
A5:  not (left_improper_integral(f,a,c) = -infty
        & right_improper_integral(f,c,b) = +infty) and
A6:  not (left_improper_integral(f,a,c) = +infty
        & right_improper_integral(f,c,b) = -infty) by A1;
    per cases by A3,Th34;
    suppose
A7:  f is_left_ext_Riemann_integrable_on a,c &
     left_improper_integral(f,a,c) = ext_left_integral(f,a,c);
     per cases by A4,Th39;
     suppose
A8:   f is_right_ext_Riemann_integrable_on c,b &
      right_improper_integral(f,c,b) = ext_right_integral(f,c,b);
      reconsider IT = ext_left_integral(f,a,c) + ext_right_integral(f,c,b)
       as ExtReal;
      take IT;
      IT = left_improper_integral(f,a,c)+right_improper_integral(f,c,b)
        by A7,A8,XXREAL_3:def 2;
      hence thesis by A2,A3,A4;
     end;
     suppose right_improper_integral(f,c,b) = +infty; then
A9:   left_improper_integral(f,a,c) + right_improper_integral(f,c,b) = +infty
        by A5,XXREAL_3:def 2;
      take IT = +infty;
      thus thesis by A2,A3,A4,A9;
     end;
     suppose right_improper_integral(f,c,b) = -infty; then
A10:  left_improper_integral(f,a,c) + right_improper_integral(f,c,b) = -infty
        by A6,XXREAL_3:def 2;
      take IT = -infty;
      thus thesis by A2,A3,A4,A10;
     end;
    end;

    suppose
A11: left_improper_integral(f,a,c) = +infty; then
     per cases by A4,A6,Th39;
     suppose
      f is_right_ext_Riemann_integrable_on c,b &
      right_improper_integral(f,c,b) = ext_right_integral(f,c,b); then
A12:  left_improper_integral(f,a,c) + right_improper_integral(f,c,b) = +infty
        by A11,XXREAL_3:def 2;
      take IT = +infty;
      thus thesis by A2,A3,A4,A12;
     end;
     suppose
      right_improper_integral(f,c,b) = +infty; then
A13:  left_improper_integral(f,a,c) + right_improper_integral(f,c,b) = +infty
       by A11,XXREAL_3:def 2;
      take IT = +infty;
      thus thesis by A2,A3,A4,A13;
     end;
    end;

    suppose
A14: left_improper_integral(f,a,c) = -infty; then
     per cases by A4,A5,Th39;
     suppose
      f is_right_ext_Riemann_integrable_on c,b &
      right_improper_integral(f,c,b) = ext_right_integral(f,c,b); then
A15:  left_improper_integral(f,a,c) + right_improper_integral(f,c,b) = -infty
        by A14,XXREAL_3:def 2;
      take IT = -infty;
      thus thesis by A2,A3,A4,A15;
     end;
     suppose
      right_improper_integral(f,c,b) = -infty; then
A16:  left_improper_integral(f,a,c) + right_improper_integral(f,c,b) = -infty
       by A14,XXREAL_3:def 2;
      take IT = -infty;
      thus thesis by A2,A3,A4,A16;
     end;
    end;
end;
uniqueness by A1,Th47;
end;

theorem Th48:
for f be PartFunc of REAL,REAL, a,c be Real st
 ].a,c.[ c= dom f & f is_improper_integrable_on a,c holds
 for b be Real st a < b < c holds
  f is_left_improper_integrable_on a,b &
  f is_right_improper_integrable_on b,c &
  improper_integral(f,a,c)
   = left_improper_integral(f,a,b) + right_improper_integral(f,b,c)
proof
    let f be PartFunc of REAL,REAL, a,c be Real;
    assume that
A1:  ].a,c.[ c= dom f and
A2:  f is_improper_integrable_on a,c;
    let b be Real;
    assume
A3:  a < b < c;

    consider b1 be Real such that
A4:  a < b1 < c and
A5:  f is_left_improper_integrable_on a,b1 and
A6:  f is_right_improper_integrable_on b1,c and
A7:  improper_integral(f,a,c)
      = left_improper_integral(f,a,b1) + right_improper_integral(f,b1,c)
        by A1,A2,Def6;

    per cases;
    suppose A8: b < b1;
     ].a,b1.] c= ].a,c.[ by A4,XXREAL_1:49; then
A9:  ].a,b1.] c= dom f by A1;
     [.b,c.[ c= ].a,c.[ by A3,XXREAL_1:48; then
A10: [.b,c.[ c= dom f by A1;
A11: f|['b,b1'] is bounded & f is_integrable_on ['b,b1'] by A5,A3,A8;

     thus f is_left_improper_integrable_on a,b by A3,A5,A8,A9,Th37;
     thus f is_right_improper_integrable_on b,c by A4,A8,A6,A10,A11,Th43;
     thus thesis by A1,A2,A3,A4,A7,Th47;
    end;
    suppose A12: b >= b1;
     ].a,b.] c= ].a,c.[ by A3,XXREAL_1:49; then
A13:  ].a,b.] c= dom f by A1;
A14: f|['b1,b'] is bounded & f is_integrable_on ['b1,b'] by A6,A3,A12;
     [.b1,c.[ c= ].a,c.[ by A4,XXREAL_1:48; then
A15: [.b1,c.[ c= dom f by A1;

     thus f is_left_improper_integrable_on a,b by A4,A5,A12,A13,A14,Th38;
     thus f is_right_improper_integrable_on b,c by A12,A3,A15,A6,Th42;
     thus thesis by A1,A2,A3,A4,A7,Th47;
    end;
end;

begin :: Linearity of Improper Integral

theorem Th49:
for f be PartFunc of REAL,REAL, a,b be Real st
 f is_left_improper_integrable_on a,b &
 left_improper_integral(f,a,b) = +infty
  holds for Intf be PartFunc of REAL,REAL st dom Intf = ].a,b.] &
  (for x be Real st x in dom Intf holds Intf.x = integral(f,x,b)) holds
  Intf is_right_divergent_to+infty_in a
proof
    let f be PartFunc of REAL,REAL, a,b be Real;
    assume that
A1:  f is_left_improper_integrable_on a,b and
A2:  left_improper_integral(f,a,b) = +infty;
    let Intf be PartFunc of REAL,REAL;
    assume that
A3:  dom Intf = ].a,b.] and
A4:  for x be Real st x in dom Intf holds Intf.x = integral(f,x,b);

    consider I be PartFunc of REAL,REAL such that
A5:  dom I = ].a,b.] &
     (for x be Real st x in dom I holds I.x = integral(f,x,b))
   & (I is_right_convergent_in a
       & left_improper_integral(f,a,b) = lim_right(I,a)
   or I is_right_divergent_to+infty_in a
       & left_improper_integral(f,a,b) = +infty
   or I is_right_divergent_to-infty_in a
       & left_improper_integral(f,a,b) = -infty) by A1,Def3;

    for x be Element of REAL st x in dom I holds I.x = Intf.x
    proof
     let x be Element of REAL;
     assume x in dom I; then
     I.x = integral(f,x,b) & Intf.x = integral(f,x,b) by A3,A4,A5;
     hence thesis;
    end;
    hence Intf is_right_divergent_to+infty_in a by A2,A3,A5,PARTFUN1:5;
end;

theorem Th50:
for f be PartFunc of REAL,REAL, a,b be Real st
 f is_left_improper_integrable_on a,b &
 left_improper_integral(f,a,b) = -infty
  holds for Intf be PartFunc of REAL,REAL st dom Intf = ].a,b.] &
  (for x be Real st x in dom Intf holds Intf.x = integral(f,x,b)) holds
  Intf is_right_divergent_to-infty_in a
proof
    let f be PartFunc of REAL,REAL, a,b be Real;
    assume that
A1:  f is_left_improper_integrable_on a,b and
A2:  left_improper_integral(f,a,b) = -infty;
    let Intf be PartFunc of REAL,REAL;
    assume that
A3:  dom Intf = ].a,b.] and
A4:  for x be Real st x in dom Intf holds Intf.x = integral(f,x,b);

    consider I be PartFunc of REAL,REAL such that
A5:  dom I = ].a,b.] &
     (for x be Real st x in dom I holds I.x = integral(f,x,b))
   & (I is_right_convergent_in a
       & left_improper_integral(f,a,b) = lim_right(I,a)
   or I is_right_divergent_to+infty_in a
       & left_improper_integral(f,a,b) = +infty
   or I is_right_divergent_to-infty_in a
       & left_improper_integral(f,a,b) = -infty) by A1,Def3;

    for x be Element of REAL st x in dom I holds I.x = Intf.x
    proof
     let x be Element of REAL;
     assume x in dom I; then
     I.x = integral(f,x,b) & Intf.x = integral(f,x,b) by A3,A4,A5;
     hence thesis;
    end;
    hence Intf is_right_divergent_to-infty_in a by A2,A3,A5,PARTFUN1:5;
end;

theorem Th51:
for f be PartFunc of REAL,REAL, a,b be Real st
 f is_right_improper_integrable_on a,b &
 right_improper_integral(f,a,b) = +infty
  holds for Intf be PartFunc of REAL,REAL st dom Intf = [.a,b.[ &
  (for x be Real st x in dom Intf holds Intf.x = integral(f,a,x)) holds
  Intf is_left_divergent_to+infty_in b
proof
    let f be PartFunc of REAL,REAL, a,b be Real;
    assume that
A1:  f is_right_improper_integrable_on a,b and
A2:  right_improper_integral(f,a,b) = +infty;
    let Intf be PartFunc of REAL,REAL;
    assume that
A3:  dom Intf = [.a,b.[ and
A4:  for x be Real st x in dom Intf holds Intf.x = integral(f,a,x);

    consider I be PartFunc of REAL,REAL such that
A5:  dom I = [.a,b.[ &
     (for x be Real st x in dom I holds I.x = integral(f,a,x))
   & (I is_left_convergent_in b
       & right_improper_integral(f,a,b) = lim_left(I,b)
   or I is_left_divergent_to+infty_in b
       & right_improper_integral(f,a,b) = +infty
   or I is_left_divergent_to-infty_in b
       & right_improper_integral(f,a,b) = -infty) by A1,Def4;

    for x be Element of REAL st x in dom I holds I.x = Intf.x
    proof
     let x be Element of REAL;
     assume x in dom I; then
     I.x = integral(f,a,x) & Intf.x = integral(f,a,x) by A3,A4,A5;
     hence thesis;
    end;
    hence Intf is_left_divergent_to+infty_in b by A2,A3,A5,PARTFUN1:5;
end;

theorem Th52:
for f be PartFunc of REAL,REAL, a,b be Real st
 f is_right_improper_integrable_on a,b &
 right_improper_integral(f,a,b) = -infty
  holds for Intf be PartFunc of REAL,REAL st dom Intf = [.a,b.[ &
  (for x be Real st x in dom Intf holds Intf.x = integral(f,a,x)) holds
  Intf is_left_divergent_to-infty_in b
proof
    let f be PartFunc of REAL,REAL, a,b be Real;
    assume that
A1:  f is_right_improper_integrable_on a,b and
A2:  right_improper_integral(f,a,b) = -infty;
    let Intf be PartFunc of REAL,REAL;
    assume that
A3:  dom Intf = [.a,b.[ and
A4:  for x be Real st x in dom Intf holds Intf.x = integral(f,a,x);

    consider I be PartFunc of REAL,REAL such that
A5:  dom I = [.a,b.[ &
     (for x be Real st x in dom I holds I.x = integral(f,a,x))
   & (I is_left_convergent_in b
       & right_improper_integral(f,a,b) = lim_left(I,b)
   or I is_left_divergent_to+infty_in b
       & right_improper_integral(f,a,b) = +infty
   or I is_left_divergent_to-infty_in b
       & right_improper_integral(f,a,b) = -infty) by A1,Def4;

    for x be Element of REAL st x in dom I holds I.x = Intf.x
    proof
     let x be Element of REAL;
     assume x in dom I; then
     I.x = integral(f,a,x) & Intf.x = integral(f,a,x) by A3,A4,A5;
     hence thesis;
    end;
    hence Intf is_left_divergent_to-infty_in b by A2,A3,A5,PARTFUN1:5;
end;

theorem Th53:
for f be PartFunc of REAL,REAL, a,b,r be Real st a < b & ].a,b.] c= dom f &
 f is_left_improper_integrable_on a,b holds
   r(#)f is_left_improper_integrable_on a,b &
   left_improper_integral(r(#)f,a,b) = r * left_improper_integral(f,a,b)
proof
    let f be PartFunc of REAL,REAL, a,b,r be Real;
    assume that
A1:  a < b and
A2:  ].a,b.] c= dom f and
A3:  f is_left_improper_integrable_on a,b;

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

    per cases;
    suppose A8: f is_left_ext_Riemann_integrable_on a,b; then
A9:  left_improper_integral(f,a,b) = ext_left_integral(f,a,b) by A3,Th34;
A10:  r(#)f is_left_ext_Riemann_integrable_on a,b &
     ext_left_integral(r(#)f,a,b) = r*ext_left_integral(f,a,b)
       by A2,A8,Th30;
     thus r(#)f is_left_improper_integrable_on a,b
       by A2,A8,Th30,Th32; then
     left_improper_integral(r(#)f,a,b) = ext_left_integral(r(#)f,a,b)
       by A10,Th34;
     hence left_improper_integral(r(#)f,a,b)
       = r * left_improper_integral(f,a,b) by A9,A10,XXREAL_3:def 5;
    end;
    suppose A11: not f is_left_ext_Riemann_integrable_on a,b;
     consider Intf be PartFunc of REAL,REAL such that
A12:   dom Intf = ].a,b.] and
A13:   for x be Real st x in dom Intf holds Intf.x = integral(f,x,b)
        by A3;
A14:  dom(r(#)Intf) = ].a,b.] by A12,VALUED_1:def 5;

A15:  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 A16: x in dom(r(#)Intf); then
A17:   (r(#)Intf).x = r*(Intf.x) by VALUED_1:def 5
       .= r*integral(f,x,b) by A16,A14,A13,A12;
A18:   a < x <= b by A14,A16,XXREAL_1:2; then
      [.x,b.] c= ].a,b.] by XXREAL_1:39; then
      [.x,b.] c= dom f by A2; then
A19:   ['x,b'] c= dom f by A18,INTEGRA5:def 3;
      f is_integrable_on ['x,b'] & f|['x,b'] is bounded by A3,A18;
      hence (r(#)Intf).x = integral(r(#)f,x,b) by A17,A18,A19,INTEGRA6:10;
     end;

     per cases by A3,A11,Th34;
     suppose A20: left_improper_integral(f,a,b) = +infty; then
A21:   Intf is_right_divergent_to+infty_in a by A3,A12,A13,Th49;

      per cases;
      suppose A22: r > 0; then
A23:    r(#)Intf is_right_divergent_to+infty_in a
          by A20,A3,A12,A13,Th49,LIMFUNC2:22;
       thus r(#)f is_left_improper_integrable_on a,b
         by A4,A14,A15,A22,A21,LIMFUNC2:22; then
       left_improper_integral(r(#)f,a,b) = +infty by A14,A15,A23,Def3;
       hence left_improper_integral(r(#)f,a,b)
         = r * left_improper_integral(f,a,b) by A20,A22,XXREAL_3:def 5;
      end;
      suppose A24: r < 0; then
A25:    r(#)Intf is_right_divergent_to-infty_in a
         by A20,A3,A12,A13,Th49,LIMFUNC2:22;
       thus r(#)f is_left_improper_integrable_on a,b
         by A4,A14,A15,A24,A21,LIMFUNC2:22; then
       left_improper_integral(r(#)f,a,b) = -infty by A14,A15,A25,Def3;
       hence left_improper_integral(r(#)f,a,b)
         = r * left_improper_integral(f,a,b) by A20,A24,XXREAL_3:def 5;
      end;
      suppose A26: r = 0;
A27:    for R be Real st a < R
        ex g be Real st g < R & a < g & g in dom(r(#)Intf)
         by A12,A14,A21,LIMFUNC2:11;
A28:    for g1 be Real st 0 < g1
        ex R be Real st a < R & for r1 be Real st r1 < R & a < r1
         & r1 in dom(r(#)Intf) holds |. (r(#)Intf).r1 - 0 .| < g1
       proof
        let g1 be Real;
        assume A29: 0 < g1;
        now let r1 be Real;
         assume r1 < b & a < r1 & r1 in dom(r(#)Intf); then
         (r(#)Intf).r1 = r * Intf.r1 by VALUED_1:def 5 .= 0 by A26;
         hence |. (r(#)Intf).r1 - 0 .| < g1 by A29,ABSVALUE:2;
        end;
        hence thesis by A1;
       end; then
A30:    r(#)Intf is_right_convergent_in a by A27,LIMFUNC2:10; then
A31:    lim_right(r(#)Intf,a) = 0 by A28,LIMFUNC2:42;
       thus r(#)f is_left_improper_integrable_on a,b
          by A4,A14,A15,A28,A27,LIMFUNC2:10; then
       left_improper_integral(r(#)f,a,b) = 0 by A14,A15,A30,A31,Def3;
       hence left_improper_integral(r(#)f,a,b)
         = r * left_improper_integral(f,a,b) by A26;
      end;
     end;
     suppose A32: left_improper_integral(f,a,b) = -infty; then
A33:   Intf is_right_divergent_to-infty_in a by A3,A12,A13,Th50;
      per cases;
      suppose A34: r > 0; then
A35:    r(#)Intf is_right_divergent_to-infty_in a
         by A32,A3,A12,A13,Th50,LIMFUNC2:22;
       thus r(#)f is_left_improper_integrable_on a,b
         by A4,A14,A15,A34,A33,LIMFUNC2:22; then
       left_improper_integral(r(#)f,a,b) = -infty by A14,A15,A35,Def3;
       hence left_improper_integral(r(#)f,a,b)
         = r * left_improper_integral(f,a,b) by A32,A34,XXREAL_3:def 5;
      end;
      suppose A36: r < 0; then
A37:    r(#)Intf is_right_divergent_to+infty_in a
         by A32,A3,A12,A13,Th50,LIMFUNC2:22;
       thus r(#)f is_left_improper_integrable_on a,b
         by A4,A14,A15,A36,A33,LIMFUNC2:22; then
       left_improper_integral(r(#)f,a,b) = +infty by A14,A15,A37,Def3;
       hence left_improper_integral(r(#)f,a,b)
         = r * left_improper_integral(f,a,b) by A32,A36,XXREAL_3:def 5;
      end;
      suppose A38: r = 0;
A39:    for R be Real st a < R
        ex g be Real st g < R & a < g & g in dom(r(#)Intf)
          by A12,A14,A33,LIMFUNC2:12;
A40:    for g1 be Real st 0 < g1
        ex R be Real st a < R & for r1 be Real st r1 < R & a < r1
         & r1 in dom(r(#)Intf) holds |. (r(#)Intf).r1 - 0 .| < g1
       proof
        let g1 be Real;
        assume A41: 0 < g1;
        now let r1 be Real;
         assume r1 < b & a < r1 & r1 in dom(r(#)Intf); then
         (r(#)Intf).r1 = r * Intf.r1 by VALUED_1:def 5 .= 0 by A38;
         hence |. (r(#)Intf).r1 - 0 .| < g1 by A41,ABSVALUE:2;
        end;
        hence thesis by A1;
       end; then
A42:    r(#)Intf is_right_convergent_in a by A39,LIMFUNC2:10; then
A43:    lim_right(r(#)Intf,a) = 0 by A40,LIMFUNC2:42;
       thus r(#)f is_left_improper_integrable_on a,b
         by A4,A14,A15,A40,A39,LIMFUNC2:10; then
       left_improper_integral(r(#)f,a,b) = 0 by A14,A15,A42,A43,Def3;
       hence left_improper_integral(r(#)f,a,b)
         = r * left_improper_integral(f,a,b) by A38;
      end;
     end;
    end;
end;

theorem Th54:
for f be PartFunc of REAL,REAL, a,b,r be Real st a < b & [.a,b.[ c= dom f &
 f is_right_improper_integrable_on a,b holds
   r(#)f is_right_improper_integrable_on a,b &
   right_improper_integral(r(#)f,a,b) = r * right_improper_integral(f,a,b)
proof
    let f be PartFunc of REAL,REAL, a,b,r be Real;
    assume that
A1:  a < b and
A2:  [.a,b.[ c= dom f and
A3:  f is_right_improper_integrable_on a,b;

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

    per cases;
    suppose A8: f is_right_ext_Riemann_integrable_on a,b; then
A9:  right_improper_integral(f,a,b) = ext_right_integral(f,a,b) by A3,Th39;
A10:  r(#)f is_right_ext_Riemann_integrable_on a,b &
     ext_right_integral(r(#)f,a,b) = r*ext_right_integral(f,a,b)
       by A2,A8,Th31;
     thus r(#)f is_right_improper_integrable_on a,b
       by A2,A8,Th31,Th33; then
     right_improper_integral(r(#)f,a,b) = ext_right_integral(r(#)f,a,b)
       by A10,Th39;
     hence right_improper_integral(r(#)f,a,b)
       = r * right_improper_integral(f,a,b) by A9,A10,XXREAL_3:def 5;
    end;
    suppose A11: not f is_right_ext_Riemann_integrable_on a,b;
     consider Intf be PartFunc of REAL,REAL such that
A12:   dom Intf = [.a,b.[ and
A13:   for x be Real st x in dom Intf holds Intf.x = integral(f,a,x)
        by A3;
A14:  dom(r(#)Intf) = [.a,b.[ by A12,VALUED_1:def 5;

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

     per cases by A3,A11,Th39;
     suppose A20: right_improper_integral(f,a,b) = +infty; then
A21:   Intf is_left_divergent_to+infty_in b by A3,A12,A13,Th51;

      per cases;
      suppose A22: r > 0; then
A23:    r(#)Intf is_left_divergent_to+infty_in b
         by A20,A3,A12,A13,Th51,LIMFUNC2:21;
       thus r(#)f is_right_improper_integrable_on a,b
         by A4,A14,A15,A22,A21,LIMFUNC2:21; then
       right_improper_integral(r(#)f,a,b) = +infty by A14,A15,A23,Def4;
       hence right_improper_integral(r(#)f,a,b)
         = r * right_improper_integral(f,a,b) by A20,A22,XXREAL_3:def 5;
      end;
      suppose A24: r < 0; then
A25:    r(#)Intf is_left_divergent_to-infty_in b
         by A20,A3,A12,A13,Th51,LIMFUNC2:21;
       thus r(#)f is_right_improper_integrable_on a,b
         by A4,A14,A15,A24,A21,LIMFUNC2:21; then
       right_improper_integral(r(#)f,a,b) = -infty by A14,A15,A25,Def4;
       hence right_improper_integral(r(#)f,a,b)
         = r * right_improper_integral(f,a,b) by A20,A24,XXREAL_3:def 5;
      end;

      suppose A26: r = 0;
A27:    for R be Real st R < b
        ex g be Real st R < g & g < b & g in dom(r(#)Intf)
         by A12,A14,A21,LIMFUNC2:8;
A28:    for g1 be Real st 0 < g1
        ex R be Real st R < b & for r1 be Real st R < r1 & r1 < b
         & r1 in dom(r(#)Intf) holds |. (r(#)Intf).r1 - 0 .| < g1
       proof
        let g1 be Real;
        assume A29: 0 < g1;
        now let r1 be Real;
         assume a < r1 & r1 < b & r1 in dom(r(#)Intf); then
         (r(#)Intf).r1 = r * Intf.r1 by VALUED_1:def 5 .= 0 by A26;
         hence |. (r(#)Intf).r1 - 0 .| < g1 by A29,ABSVALUE:2;
        end;
        hence thesis by A1;
       end; then
A30:    r(#)Intf is_left_convergent_in b by A27,LIMFUNC2:7; then
A31:    lim_left(r(#)Intf,b) = 0 by A28,LIMFUNC2:41;
       thus r(#)f is_right_improper_integrable_on a,b
         by A4,A14,A15,A28,A27,LIMFUNC2:7; then
       right_improper_integral(r(#)f,a,b) = 0 by A14,A15,A30,A31,Def4;
       hence right_improper_integral(r(#)f,a,b)
         = r * right_improper_integral(f,a,b) by A26;
      end;
     end;
     suppose A32: right_improper_integral(f,a,b) = -infty; then
A33:   Intf is_left_divergent_to-infty_in b by A3,A12,A13,Th52;
      per cases;
      suppose A34: r > 0; then
A35:    r(#)Intf is_left_divergent_to-infty_in b
         by A32,A3,A12,A13,Th52,LIMFUNC2:21;
       thus r(#)f is_right_improper_integrable_on a,b
         by A4,A14,A15,A34,A33,LIMFUNC2:21; then
       right_improper_integral(r(#)f,a,b) = -infty by A14,A15,A35,Def4;
       hence right_improper_integral(r(#)f,a,b)
         = r * right_improper_integral(f,a,b) by A32,A34,XXREAL_3:def 5;
      end;
      suppose A36: r < 0; then
A37:    r(#)Intf is_left_divergent_to+infty_in b
         by A32,A3,A12,A13,Th52,LIMFUNC2:21;
       thus r(#)f is_right_improper_integrable_on a,b
         by A4,A14,A15,A36,A33,LIMFUNC2:21; then
       right_improper_integral(r(#)f,a,b) = +infty by A14,A15,A37,Def4;
       hence right_improper_integral(r(#)f,a,b)
         = r * right_improper_integral(f,a,b) by A32,A36,XXREAL_3:def 5;
      end;
      suppose A38: r = 0;
A39:    for R be Real st R < b
        ex g be Real st R < g & g < b & g in dom(r(#)Intf)
         by A12,A14,A33,LIMFUNC2:9;
A40:    for g1 be Real st 0 < g1
        ex R be Real st R < b & for r1 be Real st R < r1 & r1 < b
         & r1 in dom(r(#)Intf) holds |. (r(#)Intf).r1 - 0 .| < g1
       proof
        let g1 be Real;
        assume A41: 0 < g1;
        now let r1 be Real;
         assume a < r1 & r1 < b & r1 in dom(r(#)Intf); then
         (r(#)Intf).r1 = r * Intf.r1 by VALUED_1:def 5 .= 0 by A38;
         hence |. (r(#)Intf).r1 - 0 .| < g1 by A41,ABSVALUE:2;
        end;
        hence thesis by A1;
       end; then
A42:    r(#)Intf is_left_convergent_in b by A39,LIMFUNC2:7; then
A43:    lim_left(r(#)Intf,b) = 0 by A40,LIMFUNC2:41;
       thus r(#)f is_right_improper_integrable_on a,b
         by A4,A14,A15,A40,A39,LIMFUNC2:7; then
       right_improper_integral(r(#)f,a,b) = 0 by A14,A15,A42,A43,Def4;
       hence right_improper_integral(r(#)f,a,b)
         = r * right_improper_integral(f,a,b) by A38;
      end;
     end;
    end;
end;

theorem Th55:
for f be PartFunc of REAL,REAL, a,b be Real st a < b & ].a,b.] c= dom f &
 f is_left_improper_integrable_on a,b holds
   -f is_left_improper_integrable_on a,b &
   left_improper_integral(-f,a,b) = - left_improper_integral(f,a,b)
proof
    let f be PartFunc of REAL,REAL, a,b be Real;
    assume A1: a < b & ].a,b.] c= dom f & f is_left_improper_integrable_on a,b;
    hence -f is_left_improper_integrable_on a,b by Th53;
    left_improper_integral(-f,a,b) = (-1) * left_improper_integral(f,a,b)
      by A1,Th53;
    hence left_improper_integral(-f,a,b) = - left_improper_integral(f,a,b)
      by XXREAL_3:91;
end;

theorem Th56:
for f be PartFunc of REAL,REAL, a,b be Real st a < b & [.a,b.[ c= dom f &
 f is_right_improper_integrable_on a,b holds
   -f is_right_improper_integrable_on a,b &
   right_improper_integral(-f,a,b) = - right_improper_integral(f,a,b)
proof
    let f be PartFunc of REAL,REAL, a,b be Real;
    assume A1: a < b & [.a,b.[ c= dom f
      & f is_right_improper_integrable_on a,b;
    hence -f is_right_improper_integrable_on a,b by Th54;
    right_improper_integral(-f,a,b) = (-1) * right_improper_integral(f,a,b)
      by A1,Th54;
    hence right_improper_integral(-f,a,b) = - right_improper_integral(f,a,b)
      by XXREAL_3:91;
end;

theorem Th57:
for f,g be PartFunc of REAL,REAL, a,b be Real
 st a < b & ].a,b.] c= dom f & ].a,b.] c= dom g
  & f is_left_improper_integrable_on a,b
  & g is_left_improper_integrable_on a,b
  & not (left_improper_integral(f,a,b) = +infty
       & left_improper_integral(g,a,b) = -infty)
  & not (left_improper_integral(f,a,b) = -infty
       & left_improper_integral(g,a,b) = +infty)
holds f+g is_left_improper_integrable_on a,b
 & left_improper_integral(f+g,a,b)
  = left_improper_integral(f,a,b) + left_improper_integral(g,a,b)
proof
    let f,g be PartFunc of REAL,REAL, a,b be Real;
    assume that
A1:  a < b and
A2:  ].a,b.] c= dom f and
A3:  ].a,b.] c= dom g and
A4:  f is_left_improper_integrable_on a,b and
A5:  g is_left_improper_integrable_on a,b and
A6:  not (left_improper_integral(f,a,b) = +infty
       & left_improper_integral(g,a,b) = -infty) and
A7:  not (left_improper_integral(f,a,b) = -infty
       & left_improper_integral(g,a,b) = +infty);

A8: for d be Real st a<d & d<=b holds
     f+g is_integrable_on ['d,b'] & (f+g)|['d,b'] is bounded
    proof
     let d be Real;
     assume
A9:   a<d & d<=b; then
A10:  f is_integrable_on ['d,b'] & f|['d,b'] is bounded &
     g is_integrable_on ['d,b'] & g|['d,b'] is bounded by A4,A5;
     [.d,b.] c= ].a,b.] by A9,XXREAL_1:39; then
     ['d,b'] c= ].a,b.] by A9,INTEGRA5:def 3; then
     ['d,b'] c= dom f & ['d,b'] c= dom g by A2,A3;
     hence f+g is_integrable_on ['d,b'] by A10,INTEGRA6:11;
     (f+g)|(['d,b'] /\ ['d,b']) is bounded by A10,RFUNCT_1:83;
     hence (f+g)|['d,b'] is bounded;
    end;
    per cases;
    suppose A11: f is_left_ext_Riemann_integrable_on a,b
     & g is_left_ext_Riemann_integrable_on a,b; then
A12:  left_improper_integral(f,a,b) = ext_left_integral(f,a,b)
   & left_improper_integral(g,a,b) = ext_left_integral(g,a,b)
       by A4,A5,Th34;
A13: f+g is_left_ext_Riemann_integrable_on a,b
   & ext_left_integral(f+g,a,b)
     = ext_left_integral(f,a,b) + ext_left_integral(g,a,b)
         by A1,A2,A3,A11,Th28;
     thus f+g is_left_improper_integrable_on a,b
       by A1,A2,A3,A11,Th28,Th32; then
     left_improper_integral(f+g,a,b) = ext_left_integral(f+g,a,b) by A13,Th34;
     hence left_improper_integral(f+g,a,b)
       = left_improper_integral(f,a,b) + left_improper_integral(g,a,b)
         by A12,A13,XXREAL_3:def 2;
    end;
    suppose A14: f is_left_ext_Riemann_integrable_on a,b &
                not g is_left_ext_Riemann_integrable_on a,b; then
A15:  left_improper_integral(f,a,b) = ext_left_integral(f,a,b) by A4,Th34;

     consider Intf be PartFunc of REAL,REAL such that
A16:  dom Intf = ].a,b.] and
A17:  for x be Real st x in dom Intf holds Intf.x = integral(f,x,b) and
A18:  Intf is_right_convergent_in a by A14,INTEGR10:def 2;

     consider Intg be PartFunc of REAL,REAL such that
A19:   dom Intg = ].a,b.] and
A20:   for x be Real st x in dom Intg holds Intg.x = integral(g,x,b) and
      (Intg is_right_convergent_in a or Intg is_right_divergent_to+infty_in a
    or Intg is_right_divergent_to-infty_in a) by A5;

A21:  dom(Intf+Intg) = ].a,b.] /\ ].a,b.] by A16,A19,VALUED_1:def 1
      .= ].a,b.];

A22:  for x be Real st x in dom(Intf+Intg) holds
       (Intf+Intg).x = integral(f+g,x,b)
     proof
      let x be Real;
      assume A23: x in dom(Intf+Intg); then
A24:   a < x <= b by A21,XXREAL_1:2; then
      [.x,b.] c= ].a,b.] by XXREAL_1:39; then
A25:   [.x,b.] c= dom f & [.x,b.] c= dom g by A2,A3;
A26:   ['x,b'] = [.x,b.] by A24,INTEGRA5:def 3;
      f is_integrable_on ['x,b'] & f|['x,b'] is bounded &
      g is_integrable_on ['x,b'] & g|['x,b'] is bounded by A4,A5,A24; then
      integral(f+g,['x,b']) = integral(f,['x,b'])+integral(g,['x,b'])
        by A25,A26,INTEGRA6:11; then
A27:   integral(f+g,x,b)
       = integral(f,['x,b'])+integral(g,['x,b']) by A24,INTEGRA5:def 4
      .= integral(f,x,b) + integral(g,['x,b']) by A24,INTEGRA5:def 4
      .= integral(f,x,b) + integral(g,x,b) by A24,INTEGRA5:def 4;

      (Intf+Intg).x = Intf.x + Intg.x by A23,VALUED_1:def 1
       .= integral(f,x,b) + Intg.x by A23,A21,A16,A17
       .= integral(f,x,b) + integral(g,x,b) by A23,A21,A19,A20;
      hence (Intf+Intg).x = integral(f+g,x,b) by A27;
     end;

A28:  for r be Real st a < r
      ex g be Real st g < r & a < g & g in dom(Intf+Intg)
     proof
      let r be Real;
      assume a < r; then
      consider g be Real such that
A29:    a < g & g < min(b,r) by A1,XXREAL_0:21,XREAL_1:5;
      take g;
      min(b,r) <= b & min(b,r) <= r by XXREAL_0:17; then
      g < b & g < r by A29,XXREAL_0:2;
      hence thesis by A29,A21,XXREAL_1:2;
     end;

     per cases by A5,A14,Th34;
     suppose A30: left_improper_integral(g,a,b) = +infty; then
A31:   Intg is_right_divergent_to+infty_in a by A5,A19,A20,Th49;

A32:   ex r be Real st 0<r & Intf|(].a,a+r.[) is bounded_below
        by A18,Th10; then
A33:   Intf+Intg is_right_divergent_to+infty_in a
         by A30,A28,A5,A19,A20,Th49,LIMFUNC2:19;
      thus f+g is_left_improper_integrable_on a,b
        by A8,A21,A22,A32,A31,A28,LIMFUNC2:19; then
      left_improper_integral(f+g,a,b) = +infty by A21,A22,A33,Def3;
      hence left_improper_integral(f+g,a,b)
       = left_improper_integral(f,a,b) + left_improper_integral(g,a,b)
         by A15,A30,XXREAL_3:def 2;
     end;
     suppose A34: left_improper_integral(g,a,b) = -infty; then
A35:   Intg is_right_divergent_to-infty_in a by A5,A19,A20,Th50;

A36:   ex r be Real st 0<r & Intf|(].a,a+r.[) is bounded_above
        by A18,Th10; then
A37:   Intf+Intg is_right_divergent_to-infty_in a
by A34,A28,A5,A19,A20,Th50,Th16;
      thus f+g is_left_improper_integrable_on a,b
         by A8,A21,A22,A36,A35,A28,Th16; then
      left_improper_integral(f+g,a,b) = -infty by A21,A22,A37,Def3;
      hence left_improper_integral(f+g,a,b)
       = left_improper_integral(f,a,b) + left_improper_integral(g,a,b)
         by A15,A34,XXREAL_3:def 2;
     end;
    end;
    suppose A38: not f is_left_ext_Riemann_integrable_on a,b &
                g is_left_ext_Riemann_integrable_on a,b; then
A39:  left_improper_integral(g,a,b) = ext_left_integral(g,a,b) by A5,Th34;

     consider Intg be PartFunc of REAL,REAL such that
A40:  dom Intg = ].a,b.] and
A41:  for x be Real st x in dom Intg holds Intg.x = integral(g,x,b) and
A42:  Intg is_right_convergent_in a by A38,INTEGR10:def 2;

     consider Intf be PartFunc of REAL,REAL such that
A43:   dom Intf = ].a,b.] and
A44:   for x be Real st x in dom Intf holds Intf.x = integral(f,x,b) and
      (Intf is_right_convergent_in a or Intf is_right_divergent_to+infty_in a
    or Intf is_right_divergent_to-infty_in a) by A4;

A45:  dom(Intf+Intg) = ].a,b.] /\ ].a,b.] by A40,A43,VALUED_1:def 1
      .= ].a,b.];

A46:  for x be Real st x in dom(Intf+Intg) holds
       (Intf+Intg).x = integral(f+g,x,b)
     proof
      let x be Real;
      assume A47: x in dom(Intf+Intg); then
A48:   a < x <= b by A45,XXREAL_1:2; then
      [.x,b.] c= ].a,b.] by XXREAL_1:39; then
A49:   [.x,b.] c= dom f & [.x,b.] c= dom g by A2,A3;
A50:   ['x,b'] = [.x,b.] by A48,INTEGRA5:def 3;
      f is_integrable_on ['x,b'] & f|['x,b'] is bounded &
      g is_integrable_on ['x,b'] & g|['x,b'] is bounded by A4,A5,A48; then
      integral(f+g,['x,b']) = integral(f,['x,b'])+integral(g,['x,b'])
        by A49,A50,INTEGRA6:11; then
A51:   integral(f+g,x,b)
       = integral(f,['x,b'])+integral(g,['x,b']) by A48,INTEGRA5:def 4
      .= integral(f,x,b) + integral(g,['x,b']) by A48,INTEGRA5:def 4
      .= integral(f,x,b) + integral(g,x,b) by A48,INTEGRA5:def 4;

      (Intf+Intg).x = Intf.x + Intg.x by A47,VALUED_1:def 1
       .= integral(f,x,b) + Intg.x by A47,A45,A43,A44
       .= integral(f,x,b) + integral(g,x,b) by A47,A45,A40,A41;
      hence (Intf+Intg).x = integral(f+g,x,b) by A51;
     end;

A52:  for r be Real st a < r
      ex g be Real st g < r & a < g & g in dom(Intf+Intg)
     proof
      let r be Real;
      assume a < r; then
      consider g be Real such that
A53:    a < g & g < min(b,r) by A1,XXREAL_0:21,XREAL_1:5;
      take g;
      min(b,r) <= b & min(b,r) <= r by XXREAL_0:17; then
      g < b & g < r by A53,XXREAL_0:2;
      hence thesis by A53,A45,XXREAL_1:2;
     end;

     per cases by A4,A38,Th34;
     suppose A54: left_improper_integral(f,a,b) = +infty;
      ex r be Real st 0<r & Intg|(].a,a+r.[) is bounded_below
        by A42,Th10; then
A55:   Intf+Intg is_right_divergent_to+infty_in a
        by A54,A52,A4,A43,A44,Th49,LIMFUNC2:19;
      hence f+g is_left_improper_integrable_on a,b by A8,A45,A46; then
      left_improper_integral(f+g,a,b) = +infty by A45,A46,A55,Def3;
      hence left_improper_integral(f+g,a,b)
       = left_improper_integral(f,a,b) + left_improper_integral(g,a,b)
         by A39,A54,XXREAL_3:def 2;
     end;
     suppose A56: left_improper_integral(f,a,b) = -infty;
      ex r be Real st 0<r & Intg|(].a,a+r.[) is bounded_above
        by A42,Th10; then
A57:   Intf+Intg is_right_divergent_to-infty_in a
        by A56,A52,A4,A43,A44,Th50,Th16;
      hence f+g is_left_improper_integrable_on a,b by A8,A45,A46; then
      left_improper_integral(f+g,a,b) = -infty by A45,A46,A57,Def3;
      hence left_improper_integral(f+g,a,b)
       = left_improper_integral(f,a,b) + left_improper_integral(g,a,b)
         by A39,A56,XXREAL_3:def 2;
     end;
    end;
    suppose A58: not f is_left_ext_Riemann_integrable_on a,b &
     not g is_left_ext_Riemann_integrable_on a,b;

     consider Intf be PartFunc of REAL,REAL such that
A59:   dom Intf = ].a,b.] and
A60:   for x be Real st x in dom Intf holds Intf.x = integral(f,x,b) and
      (Intf is_right_convergent_in a or Intf is_right_divergent_to+infty_in a
    or Intf is_right_divergent_to-infty_in a) by A4;

     consider Intg be PartFunc of REAL,REAL such that
A61:   dom Intg = ].a,b.] and
A62:   for x be Real st x in dom Intg holds Intg.x = integral(g,x,b) and
      (Intg is_right_convergent_in a or Intg is_right_divergent_to+infty_in a
    or Intg is_right_divergent_to-infty_in a) by A5;

A63:  dom(Intf+Intg) = ].a,b.] /\ ].a,b.] by A61,A59,VALUED_1:def 1
      .= ].a,b.];

A64:  for x be Real st x in dom(Intf+Intg) holds
       (Intf+Intg).x = integral(f+g,x,b)
     proof
      let x be Real;
      assume A65: x in dom(Intf+Intg); then
A66:   a < x <= b by A63,XXREAL_1:2; then
      [.x,b.] c= ].a,b.] by XXREAL_1:39; then
A67:   [.x,b.] c= dom f & [.x,b.] c= dom g by A2,A3;
A68:   ['x,b'] = [.x,b.] by A66,INTEGRA5:def 3;
      f is_integrable_on ['x,b'] & f|['x,b'] is bounded &
      g is_integrable_on ['x,b'] & g|['x,b'] is bounded by A4,A5,A66; then
      integral(f+g,['x,b']) = integral(f,['x,b'])+integral(g,['x,b'])
        by A67,A68,INTEGRA6:11; then
A69:   integral(f+g,x,b)
       = integral(f,['x,b'])+integral(g,['x,b']) by A66,INTEGRA5:def 4
      .= integral(f,x,b) + integral(g,['x,b']) by A66,INTEGRA5:def 4
      .= integral(f,x,b) + integral(g,x,b) by A66,INTEGRA5:def 4;

      (Intf+Intg).x = Intf.x + Intg.x by A65,VALUED_1:def 1
       .= integral(f,x,b) + Intg.x by A65,A63,A59,A60
       .= integral(f,x,b) + integral(g,x,b) by A65,A63,A61,A62;
      hence (Intf+Intg).x = integral(f+g,x,b) by A69;
     end;

A70:  for r be Real st a < r
      ex g be Real st g < r & a < g & g in dom(Intf+Intg)
     proof
      let r be Real;
      assume a < r; then
      consider g be Real such that
A71:    a < g & g < min(b,r) by A1,XXREAL_0:21,XREAL_1:5;
      take g;
      min(b,r) <= b & min(b,r) <= r by XXREAL_0:17; then
      g < b & g < r by A71,XXREAL_0:2;
      hence thesis by A71,A63,XXREAL_1:2;
     end;

     per cases by A4,A58,Th34;
     suppose A72: left_improper_integral(f,a,b) = +infty; then
A73:   Intf is_right_divergent_to+infty_in a by A4,A59,A60,Th49;

   left_improper_integral(g,a,b) = +infty by A72,A5,A58,Th34,A6; then
A74:   ex r be Real st 0<r & Intg|(].a,a+r.[) is bounded_below
        by A5,A61,A62,Th49,Th12; then
A75:   Intf+Intg is_right_divergent_to+infty_in a
        by A70,A72,A4,A59,A60,Th49,LIMFUNC2:19;
      thus f+g is_left_improper_integrable_on a,b
        by A8,A63,A64,A74,A73,A70,LIMFUNC2:19; then
      left_improper_integral(f+g,a,b) = +infty by A63,A64,A75,Def3;
      hence left_improper_integral(f+g,a,b)
       = left_improper_integral(f,a,b) + left_improper_integral(g,a,b)
         by A6,A72,XXREAL_3:def 2;
     end;
     suppose A76: left_improper_integral(f,a,b) = -infty; then
A77:   Intf is_right_divergent_to-infty_in a by A4,A59,A60,Th50;

   left_improper_integral(g,a,b) = -infty by A76,A5,A58,Th34,A7; then
A78:   ex r be Real st 0<r & Intg|(].a,a+r.[) is bounded_above
        by A5,A61,A62,Th50,Th13; then
A79:   Intf+Intg is_right_divergent_to-infty_in a
        by A76,A70,A4,A59,A60,Th50,Th16;
      thus f+g is_left_improper_integrable_on a,b
        by A8,A63,A64,A77,A70,A78,Th16; then
      left_improper_integral(f+g,a,b) = -infty by A63,A64,A79,Def3;
      hence left_improper_integral(f+g,a,b)
       = left_improper_integral(f,a,b) + left_improper_integral(g,a,b)
         by A7,A76,XXREAL_3:def 2;
     end;
    end;
end;

theorem Th58:
for f,g be PartFunc of REAL,REAL, a,b be Real
 st a < b & [.a,b.[ c= dom f & [.a,b.[ c= dom g
  & f is_right_improper_integrable_on a,b
  & g is_right_improper_integrable_on a,b
  & not (right_improper_integral(f,a,b) = +infty
       & right_improper_integral(g,a,b) = -infty)
  & not (right_improper_integral(f,a,b) = -infty
       & right_improper_integral(g,a,b) = +infty)
holds f+g is_right_improper_integrable_on a,b
 & right_improper_integral(f+g,a,b)
  = right_improper_integral(f,a,b) + right_improper_integral(g,a,b)
proof
    let f,g be PartFunc of REAL,REAL, a,b be Real;
    assume that
A1:  a < b and
A2:  [.a,b.[ c= dom f and
A3:  [.a,b.[ c= dom g and
A4:  f is_right_improper_integrable_on a,b and
A5:  g is_right_improper_integrable_on a,b and
A6:  not (right_improper_integral(f,a,b) = +infty
       & right_improper_integral(g,a,b) = -infty) and
A7:  not (right_improper_integral(f,a,b) = -infty
       & right_improper_integral(g,a,b) = +infty);

A8: for d be Real st a<=d & d<b holds
     f+g is_integrable_on ['a,d'] & (f+g)|['a,d'] is bounded
    proof
     let d be Real;
     assume
A9:   a<=d & d<b; then
A10:  f is_integrable_on ['a,d'] & f|['a,d'] is bounded &
     g is_integrable_on ['a,d'] & g|['a,d'] is bounded by A4,A5;
     [.a,d.] c= [.a,b.[ by A9,XXREAL_1:43; then
     ['a,d'] c= [.a,b.[ by A9,INTEGRA5:def 3; then
     ['a,d'] c= dom f & ['a,d'] c= dom g by A2,A3;
     hence f+g is_integrable_on ['a,d'] by A10,INTEGRA6:11;
     (f+g)|(['a,d'] /\ ['a,d']) is bounded by A10,RFUNCT_1:83;
     hence (f+g)|['a,d'] is bounded;
    end;

    per cases;
    suppose A11: f is_right_ext_Riemann_integrable_on a,b
     & g is_right_ext_Riemann_integrable_on a,b; then
A12:  right_improper_integral(f,a,b) = ext_right_integral(f,a,b)
   & right_improper_integral(g,a,b) = ext_right_integral(g,a,b)
       by A4,A5,Th39;
A13: f+g is_right_ext_Riemann_integrable_on a,b
   & ext_right_integral(f+g,a,b)
     = ext_right_integral(f,a,b) + ext_right_integral(g,a,b)
         by A1,A2,A3,A11,Th29;
     thus f+g is_right_improper_integrable_on a,b
       by A1,A2,A3,A11,Th29,Th33; then
     right_improper_integral(f+g,a,b) = ext_right_integral(f+g,a,b)
       by A13,Th39;
     hence right_improper_integral(f+g,a,b)
       = right_improper_integral(f,a,b) + right_improper_integral(g,a,b)
         by A12,A13,XXREAL_3:def 2;
    end;
    suppose A14: f is_right_ext_Riemann_integrable_on a,b &
                not g is_right_ext_Riemann_integrable_on a,b; then
A15:  right_improper_integral(f,a,b) = ext_right_integral(f,a,b) by A4,Th39;

     consider Intf be PartFunc of REAL,REAL such that
A16:  dom Intf = [.a,b.[ and
A17:  for x be Real st x in dom Intf holds Intf.x = integral(f,a,x) and
A18:  Intf is_left_convergent_in b by A14,INTEGR10:def 1;

     consider Intg be PartFunc of REAL,REAL such that
A19:   dom Intg = [.a,b.[ and
A20:   for x be Real st x in dom Intg holds Intg.x = integral(g,a,x) and
      (Intg is_left_convergent_in b or Intg is_left_divergent_to+infty_in b
    or Intg is_left_divergent_to-infty_in b) by A5;

A21:  dom(Intf+Intg) = [.a,b.[ /\ [.a,b.[ by A16,A19,VALUED_1:def 1
      .= [.a,b.[;

A22:  for x be Real st x in dom(Intf+Intg) holds
       (Intf+Intg).x = integral(f+g,a,x)
     proof
      let x be Real;
      assume A23: x in dom(Intf+Intg); then
A24:   a <= x < b by A21,XXREAL_1:3; then
      [.a,x.] c= [.a,b.[ by XXREAL_1:43; then
A25:   [.a,x.] c= dom f & [.a,x.] c= dom g by A2,A3;
A26:   ['a,x'] = [.a,x.] by A24,INTEGRA5:def 3;
   f is_integrable_on ['a,x'] & f|['a,x'] is bounded &
      g is_integrable_on ['a,x'] & g|['a,x'] is bounded by A4,A5,A24; then
      integral(f+g,['a,x']) = integral(f,['a,x'])+integral(g,['a,x'])
        by A25,A26,INTEGRA6:11; then
A27:   integral(f+g,a,x)
       = integral(f,['a,x'])+integral(g,['a,x']) by A24,INTEGRA5:def 4
      .= integral(f,a,x) + integral(g,['a,x']) by A24,INTEGRA5:def 4
      .= integral(f,a,x) + integral(g,a,x) by A24,INTEGRA5:def 4;

      (Intf+Intg).x = Intf.x + Intg.x by A23,VALUED_1:def 1
       .= integral(f,a,x) + Intg.x by A23,A21,A16,A17
       .= integral(f,a,x) + integral(g,a,x) by A23,A21,A19,A20;
      hence (Intf+Intg).x = integral(f+g,a,x) by A27;
     end;

A28:  for r be Real st r < b
      ex g be Real st r < g & g < b & g in dom(Intf+Intg)
     proof
      let r be Real;
      assume r < b; then
      consider g be Real such that
A29:    max(a,r) < g & g < b by A1,XXREAL_0:29,XREAL_1:5;
      take g;
      max(a,r) >= a & max(a,r) >= r by XXREAL_0:25; then
      r < g & a < g by A29,XXREAL_0:2;
      hence thesis by A29,A21,XXREAL_1:3;
     end;

A30:  (ex r be Real st 0<r & Intf|(].b-r,b.[) is bounded_below)
   & (ex r be Real st 0<r & Intf|(].b-r,b.[) is bounded_above)
       by A18,Th11;

     per cases by A5,A14,Th39;
     suppose A31: right_improper_integral(g,a,b) = +infty; then
A32:   Intf+Intg is_left_divergent_to+infty_in b
        by A28,A5,A19,A20,A30,Th51,LIMFUNC2:17;
      hence f+g is_right_improper_integrable_on a,b by A8,A21,A22; then
      right_improper_integral(f+g,a,b) = +infty by A21,A22,A32,Def4;
      hence right_improper_integral(f+g,a,b)
       = right_improper_integral(f,a,b) + right_improper_integral(g,a,b)
         by A15,A31,XXREAL_3:def 2;
     end;
     suppose A33: right_improper_integral(g,a,b) = -infty; then
A34:   Intf+Intg is_left_divergent_to-infty_in b
        by A28,A5,A19,A20,A30,Th52,Th17;
      hence f+g is_right_improper_integrable_on a,b by A8,A21,A22; then
      right_improper_integral(f+g,a,b) = -infty by A21,A22,A34,Def4;
      hence right_improper_integral(f+g,a,b)
       = right_improper_integral(f,a,b) + right_improper_integral(g,a,b)
         by A15,A33,XXREAL_3:def 2;
     end;
    end;
    suppose A35: not f is_right_ext_Riemann_integrable_on a,b &
                g is_right_ext_Riemann_integrable_on a,b; then
A36:  right_improper_integral(g,a,b) = ext_right_integral(g,a,b) by A5,Th39;

     consider Intg be PartFunc of REAL,REAL such that
A37:  dom Intg = [.a,b.[ and
A38:  for x be Real st x in dom Intg holds Intg.x = integral(g,a,x) and
A39:  Intg is_left_convergent_in b by A35,INTEGR10:def 1;

     consider Intf be PartFunc of REAL,REAL such that
A40:   dom Intf = [.a,b.[ and
A41:   for x be Real st x in dom Intf holds Intf.x = integral(f,a,x) and
      (Intf is_left_convergent_in b or Intf is_left_divergent_to+infty_in b
    or Intf is_left_divergent_to-infty_in b) by A4;

A42:  dom(Intf+Intg) = [.a,b.[ /\ [.a,b.[ by A37,A40,VALUED_1:def 1
      .= [.a,b.[;

A43:  for x be Real st x in dom(Intf+Intg) holds
       (Intf+Intg).x = integral(f+g,a,x)
     proof
      let x be Real;
      assume A44: x in dom(Intf+Intg); then
A45:   a <= x < b by A42,XXREAL_1:3; then
      [.a,x.] c= [.a,b.[ by XXREAL_1:43; then
A46:   [.a,x.] c= dom f & [.a,x.] c= dom g by A2,A3;
A47:   ['a,x'] = [.a,x.] by A45,INTEGRA5:def 3;
   f is_integrable_on ['a,x'] & f|['a,x'] is bounded &
      g is_integrable_on ['a,x'] & g|['a,x'] is bounded by A4,A5,A45; then
      integral(f+g,['a,x']) = integral(f,['a,x'])+integral(g,['a,x'])
        by A46,A47,INTEGRA6:11; then
A48:   integral(f+g,a,x)
       = integral(f,['a,x'])+integral(g,['a,x']) by A45,INTEGRA5:def 4
      .= integral(f,a,x) + integral(g,['a,x']) by A45,INTEGRA5:def 4
      .= integral(f,a,x) + integral(g,a,x) by A45,INTEGRA5:def 4;
      (Intf+Intg).x = Intf.x + Intg.x by A44,VALUED_1:def 1
       .= integral(f,a,x) + Intg.x by A44,A42,A40,A41
       .= integral(f,a,x) + integral(g,a,x) by A44,A42,A37,A38;
      hence (Intf+Intg).x = integral(f+g,a,x) by A48;
     end;

A49:  for r be Real st r < b
      ex g be Real st r < g & g < b & g in dom(Intf+Intg)
     proof
      let r be Real;
      assume r < b; then
      consider g be Real such that
A50:    max(a,r) < g & g < b by A1,XXREAL_0:29,XREAL_1:5;
      take g;
      max(a,r) >= a & max(a,r) >= r by XXREAL_0:25; then
      r < g & a < g by A50,XXREAL_0:2;
      hence thesis by A50,A42,XXREAL_1:3;
     end;

A51:  (ex r be Real st 0<r & Intg|(].b-r,b.[) is bounded_below)
   & (ex r be Real st 0<r & Intg|(].b-r,b.[) is bounded_above)
       by A39,Th11;
     per cases by A4,A35,Th39;
     suppose A52: right_improper_integral(f,a,b) = +infty; then
A53:   Intf+Intg is_left_divergent_to+infty_in b
        by A49,A4,A40,A41,A51,Th51,LIMFUNC2:17;
      hence f+g is_right_improper_integrable_on a,b by A8,A42,A43; then
      right_improper_integral(f+g,a,b) = +infty by A42,A43,A53,Def4;
      hence right_improper_integral(f+g,a,b)
       = right_improper_integral(f,a,b) + right_improper_integral(g,a,b)
         by A36,A52,XXREAL_3:def 2;
     end;
     suppose A54: right_improper_integral(f,a,b) = -infty; then
A55:   Intf+Intg is_left_divergent_to-infty_in b
        by A49,A4,A40,A41,A51,Th52,Th17;
      hence f+g is_right_improper_integrable_on a,b by A8,A42,A43; then
      right_improper_integral(f+g,a,b) = -infty by A42,A43,A55,Def4;
      hence right_improper_integral(f+g,a,b)
       = right_improper_integral(f,a,b) + right_improper_integral(g,a,b)
         by A36,A54,XXREAL_3:def 2;
     end;
    end;
    suppose A56: not f is_right_ext_Riemann_integrable_on a,b &
     not g is_right_ext_Riemann_integrable_on a,b;

     consider Intf be PartFunc of REAL,REAL such that
A57:   dom Intf = [.a,b.[ and
A58:   for x be Real st x in dom Intf holds Intf.x = integral(f,a,x) and
      (Intf is_left_convergent_in b or Intf is_left_divergent_to+infty_in b
    or Intf is_left_divergent_to-infty_in b) by A4;

     consider Intg be PartFunc of REAL,REAL such that
A59:   dom Intg = [.a,b.[ and
A60:   for x be Real st x in dom Intg holds Intg.x = integral(g,a,x) and
      (Intg is_left_convergent_in b or Intg is_left_divergent_to+infty_in b
    or Intg is_left_divergent_to-infty_in b) by A5;

A61:  dom(Intf+Intg) = [.a,b.[ /\ [.a,b.[ by A59,A57,VALUED_1:def 1
      .= [.a,b.[;

A62:  for x be Real st x in dom(Intf+Intg) holds
       (Intf+Intg).x = integral(f+g,a,x)
     proof
      let x be Real;
      assume A63: x in dom(Intf+Intg); then
A64:   a <= x < b by A61,XXREAL_1:3; then
      [.a,x.] c= [.a,b.[ by XXREAL_1:43; then
A65:   [.a,x.] c= dom f & [.a,x.] c= dom g by A2,A3;
A66:   ['a,x'] = [.a,x.] by A64,INTEGRA5:def 3;
      f is_integrable_on ['a,x'] & f|['a,x'] is bounded &
      g is_integrable_on ['a,x'] & g|['a,x'] is bounded by A4,A5,A64; then
      integral(f+g,['a,x']) = integral(f,['a,x'])+integral(g,['a,x'])
        by A65,A66,INTEGRA6:11; then
A67:   integral(f+g,a,x)
       = integral(f,['a,x'])+integral(g,['a,x']) by A64,INTEGRA5:def 4
      .= integral(f,a,x) + integral(g,['a,x']) by A64,INTEGRA5:def 4
      .= integral(f,a,x) + integral(g,a,x) by A64,INTEGRA5:def 4;

      (Intf+Intg).x = Intf.x + Intg.x by A63,VALUED_1:def 1
       .= integral(f,a,x) + Intg.x by A63,A61,A57,A58
       .= integral(f,a,x) + integral(g,a,x) by A63,A61,A59,A60;
      hence (Intf+Intg).x = integral(f+g,a,x) by A67;
     end;

A68:  for r be Real st r < b
      ex g be Real st r < g & g < b & g in dom(Intf+Intg)
     proof
      let r be Real;
      assume r < b; then
      consider g be Real such that
A69:    max(a,r) < g & g < b by A1,XXREAL_0:29,XREAL_1:5;
      take g;
      max(a,r) >= a & max(a,r) >= r by XXREAL_0:25; then
      r < g & a < g by A69,XXREAL_0:2;
      hence thesis by A69,A61,XXREAL_1:3;
     end;

     per cases by A4,A56,Th39;
     suppose A70: right_improper_integral(f,a,b) = +infty; then
      right_improper_integral(g,a,b) = +infty by A5,A56,Th39,A6; then
      ex r be Real st 0<r & Intg|(].b-r,b.[) is bounded_below
        by A5,A59,A60,Th51,Th14; then
A71:   Intf+Intg is_left_divergent_to+infty_in b
        by A70,A68,A4,A57,A58,Th51,LIMFUNC2:17;
      hence f+g is_right_improper_integrable_on a,b by A8,A61,A62; then
      right_improper_integral(f+g,a,b) = +infty by A61,A62,A71,Def4;
      hence right_improper_integral(f+g,a,b)
       = right_improper_integral(f,a,b) + right_improper_integral(g,a,b)
         by A70,A6,XXREAL_3:def 2;
     end;
     suppose A72: right_improper_integral(f,a,b) = -infty; then
      right_improper_integral(g,a,b) = -infty by A5,A56,Th39,A7; then
      ex r be Real st 0<r & Intg|(].b-r,b.[) is bounded_above
        by A5,A59,A60,Th52,Th15; then
A73:   Intf+Intg is_left_divergent_to-infty_in b
        by A72,A68,A4,A57,A58,Th52,Th17;
      hence f+g is_right_improper_integrable_on a,b by A8,A61,A62; then
      right_improper_integral(f+g,a,b) = -infty by A61,A62,A73,Def4;
      hence right_improper_integral(f+g,a,b)
       = right_improper_integral(f,a,b) + right_improper_integral(g,a,b)
         by A72,A7,XXREAL_3:def 2;
     end;
    end;
end;

theorem
for f,g be PartFunc of REAL,REAL, a,b be Real
 st a < b & ].a,b.] c= dom f & ].a,b.] c= dom g
  & f is_left_improper_integrable_on a,b
  & g is_left_improper_integrable_on a,b
  & not (left_improper_integral(f,a,b) = +infty
       & left_improper_integral(g,a,b) = +infty)
  & not (left_improper_integral(f,a,b) = -infty
       & left_improper_integral(g,a,b) = -infty)
holds f-g is_left_improper_integrable_on a,b
 & left_improper_integral(f-g,a,b)
  = left_improper_integral(f,a,b) - left_improper_integral(g,a,b)
proof
    let f,g be PartFunc of REAL,REAL, a,b be Real;
    assume that
A1:  a < b and
A2:  ].a,b.] c= dom f and
A3:  ].a,b.] c= dom g and
A4:  f is_left_improper_integrable_on a,b and
A5:  g is_left_improper_integrable_on a,b and
A6:  not (left_improper_integral(f,a,b) = +infty
       & left_improper_integral(g,a,b) = +infty) and
A7:  not (left_improper_integral(f,a,b) = -infty
       & left_improper_integral(g,a,b) = -infty);
A8: dom(-g) = dom g by VALUED_1:8;
A9: -g is_left_improper_integrable_on a,b by A1,A3,A5,Th55;
A10:now assume A11: left_improper_integral(f,a,b) = +infty &
     left_improper_integral(-g,a,b) = -infty; then
     -left_improper_integral(g,a,b) = -(+infty) by A1,A3,A5,Th55,XXREAL_3:6;
     hence contradiction by A6,A11,XXREAL_3:10;
    end;
A12:now assume A13: left_improper_integral(f,a,b) = -infty &
     left_improper_integral(-g,a,b) = +infty; then
     -left_improper_integral(g,a,b) = -(-infty) by A1,A3,A5,Th55,XXREAL_3:5;
     hence contradiction by A7,A13,XXREAL_3:10;
    end;
    hence f-g is_left_improper_integrable_on a,b
      by A1,A2,A3,A8,A4,A9,A10,Th57;
    left_improper_integral(f-g,a,b)
     = left_improper_integral(f,a,b) + left_improper_integral(-g,a,b)
       by A1,A2,A3,A8,A4,A9,A10,A12,Th57
    .= left_improper_integral(f,a,b) + (-left_improper_integral(g,a,b))
       by A1,A3,A5,Th55;
    hence left_improper_integral(f-g,a,b)
      = left_improper_integral(f,a,b) - left_improper_integral(g,a,b)
       by XXREAL_3:def 4;
end;

theorem
for f,g be PartFunc of REAL,REAL, a,b be Real
 st a < b & [.a,b.[ c= dom f & [.a,b.[ c= dom g
  & f is_right_improper_integrable_on a,b
  & g is_right_improper_integrable_on a,b
  & not (right_improper_integral(f,a,b) = +infty
       & right_improper_integral(g,a,b) = +infty)
  & not (right_improper_integral(f,a,b) = -infty
       & right_improper_integral(g,a,b) = -infty)
holds f-g is_right_improper_integrable_on a,b
 & right_improper_integral(f-g,a,b)
  = right_improper_integral(f,a,b) - right_improper_integral(g,a,b)
proof
    let f,g be PartFunc of REAL,REAL, a,b be Real;
    assume that
A1:  a < b and
A2:  [.a,b.[ c= dom f and
A3:  [.a,b.[ c= dom g and
A4:  f is_right_improper_integrable_on a,b and
A5:  g is_right_improper_integrable_on a,b and
A6:  not (right_improper_integral(f,a,b) = +infty
       & right_improper_integral(g,a,b) = +infty) and
A7:  not (right_improper_integral(f,a,b) = -infty
       & right_improper_integral(g,a,b) = -infty);
A8: dom(-g) = dom g by VALUED_1:8;
A9: -g is_right_improper_integrable_on a,b by A1,A3,A5,Th56;
A10:now assume A11: right_improper_integral(f,a,b) = +infty &
     right_improper_integral(-g,a,b) = -infty; then
     -right_improper_integral(g,a,b) = -(+infty)
       by A1,A3,A5,Th56,XXREAL_3:6;
     hence contradiction by A6,A11,XXREAL_3:10;
    end;
A12:now assume A13: right_improper_integral(f,a,b) = -infty &
     right_improper_integral(-g,a,b) = +infty; then
     -right_improper_integral(g,a,b) = -(-infty)
       by A1,A3,A5,Th56,XXREAL_3:5;
     hence contradiction by A7,A13,XXREAL_3:10;
    end;
    hence f-g is_right_improper_integrable_on a,b
      by A1,A2,A3,A8,A4,A9,A10,Th58;
    right_improper_integral(f-g,a,b)
     = right_improper_integral(f,a,b) + right_improper_integral(-g,a,b)
       by A1,A2,A3,A8,A4,A9,A10,A12,Th58
    .= right_improper_integral(f,a,b) + (-right_improper_integral(g,a,b))
       by A1,A3,A5,Th56;
    hence right_improper_integral(f-g,a,b)
      = right_improper_integral(f,a,b) - right_improper_integral(g,a,b)
        by XXREAL_3:def 4;
end;

theorem Th61:
for f be PartFunc of REAL,REAL, a,b,r be Real st ].a,b.[ c= dom f &
 f is_improper_integrable_on a,b holds
  r(#)f is_improper_integrable_on a,b &
  improper_integral(r(#)f,a,b) = r * improper_integral(f,a,b)
proof
    let f be PartFunc of REAL,REAL, a,b,r be Real;
    assume that
A1:  ].a,b.[ c= dom f and
A2:  f is_improper_integrable_on a,b;

    consider c be Real such that
A3:  a < c < b and
     f is_left_improper_integrable_on a,c and
     f is_right_improper_integrable_on c,b and
A4:  not (left_improper_integral(f,a,c) = -infty
        & right_improper_integral(f,c,b) = +infty) and
A5:  not (left_improper_integral(f,a,c) = +infty
        & right_improper_integral(f,c,b) = -infty) by A2;

    ].a,c.] c= ].a,b.[ & [.c,b.[ c= ].a,b.[ by A3,XXREAL_1:48,49; then
A6: ].a,c.] c= dom f & [.c,b.[ c= dom f by A1;

    f is_left_improper_integrable_on a,c
  & f is_right_improper_integrable_on c,b by A1,A2,A3,Th48; then
A7: r(#)f is_left_improper_integrable_on a,c
  & r(#)f is_right_improper_integrable_on c,b
  & left_improper_integral(r(#)f,a,c) = r * left_improper_integral(f,a,c)
  & right_improper_integral(r(#)f,c,b) = r * right_improper_integral(f,c,b)
  by A3,A6,Th53,Th54;

A8: left_improper_integral(r(#)f,a,c) + right_improper_integral(r(#)f,c,b)
     = r * (left_improper_integral(f,a,c) + right_improper_integral(f,c,b))
       by A7,XXREAL_3:95
    .= r * improper_integral(f,a,b) by A1,A2,A3,Th48;

A9: dom(r(#)f) = dom f by VALUED_1:def 5;

    per cases;
    suppose r = 0;
     hence r(#)f is_improper_integrable_on a,b by A3,A7;
     hence improper_integral(r(#)f,a,b) = r * improper_integral(f,a,b)
       by A1,A3,A8,A9,Th48;
    end;
    suppose A10: r > 0;
A11:  now assume A12: left_improper_integral(r(#)f,a,c) = -infty
       & right_improper_integral(r(#)f,c,b) = +infty; then
      left_improper_integral(f,a,c) = +infty or
      left_improper_integral(f,a,c) = -infty by A7,XXREAL_3:70;
      hence contradiction by A4,A12,A7,A10,XXREAL_3:69;
     end;

A13:  now assume A14: left_improper_integral(r(#)f,a,c) = +infty
       & right_improper_integral(r(#)f,c,b) = -infty; then
      left_improper_integral(f,a,c) = +infty or
      left_improper_integral(f,a,c) = -infty by A7,XXREAL_3:69;
      hence contradiction by A5,A14,A7,A10,XXREAL_3:70;
     end;

     thus r(#)f is_improper_integrable_on a,b by A3,A7,A11,A13;
     hence improper_integral(r(#)f,a,b) = r * improper_integral(f,a,b)
       by A1,A3,A8,A9,Th48;
    end;
    suppose A15: r < 0;
A16:  now assume A17: left_improper_integral(r(#)f,a,c) = -infty
       & right_improper_integral(r(#)f,c,b) = +infty; then
      left_improper_integral(f,a,c) = +infty or
      left_improper_integral(f,a,c) = -infty by A7,XXREAL_3:70;
      hence contradiction by A5,A17,A7,A15,XXREAL_3:69;
     end;

A18:  now assume A19: left_improper_integral(r(#)f,a,c) = +infty
       & right_improper_integral(r(#)f,c,b) = -infty; then
      left_improper_integral(f,a,c) = +infty or
      left_improper_integral(f,a,c) = -infty by A7,XXREAL_3:69;
      hence contradiction by A4,A19,A7,A15,XXREAL_3:70;
     end;

     thus r(#)f is_improper_integrable_on a,b by A3,A7,A16,A18;
     hence improper_integral(r(#)f,a,b) = r * improper_integral(f,a,b)
       by A1,A3,A8,A9,Th48;
    end;
end;

theorem Th62:
for f be PartFunc of REAL,REAL, a,b,r be Real st ].a,b.[ c= dom f &
 f is_improper_integrable_on a,b holds
  -f is_improper_integrable_on a,b &
  improper_integral(-f,a,b) = - improper_integral(f,a,b)
proof
    let f be PartFunc of REAL,REAL, a,b,r be Real;
    assume ].a,b.[ c= dom f & f is_improper_integrable_on a,b; then
    (-1)(#)f is_improper_integrable_on a,b &
    improper_integral((-1)(#)f,a,b) = (-1) * improper_integral(f,a,b)
      by Th61;
    hence thesis by XXREAL_3:91;
end;

theorem Th63:
for f,g be PartFunc of REAL,REAL, a,b be Real st ].a,b.[ c= dom f &
 ].a,b.[ c= dom g & f is_improper_integrable_on a,b &
 g is_improper_integrable_on a,b &
 not (improper_integral(f,a,b) = +infty & improper_integral(g,a,b) = -infty) &
 not (improper_integral(f,a,b) = -infty & improper_integral(g,a,b) = +infty)
 holds
  f+g is_improper_integrable_on a,b &
  improper_integral(f+g,a,b)
   = improper_integral(f,a,b)+improper_integral(g,a,b)
proof
    let f,g be PartFunc of REAL,REAL, a,b be Real;
    assume that
A1:  ].a,b.[ c= dom f and
A2:  ].a,b.[ c= dom g and
A3:  f is_improper_integrable_on a,b and
A4:  g is_improper_integrable_on a,b and
A5:  not (improper_integral(f,a,b) = +infty
        & improper_integral(g,a,b) = -infty) and
A6:  not (improper_integral(f,a,b) = -infty
        & improper_integral(g,a,b) = +infty);

    consider c be Real such that
A7:  a < c < b and
A8:  f is_left_improper_integrable_on a,c and
A9: f is_right_improper_integrable_on c,b and
A10: not (left_improper_integral(f,a,c) = -infty
       & right_improper_integral(f,c,b) = +infty) and
A11: not (left_improper_integral(f,a,c) = +infty
       & right_improper_integral(f,c,b) = -infty) by A3;

    consider c1 be Real such that
A12: a < c1 < b and
A13: g is_left_improper_integrable_on a,c1 and
A14: g is_right_improper_integrable_on c1,b and
A15: not (left_improper_integral(g,a,c1) = -infty
       & right_improper_integral(g,c1,b) = +infty) and
A16: not (left_improper_integral(g,a,c1) = +infty
       & right_improper_integral(g,c1,b) = -infty) by A4;

    ].a,c.] c= ].a,b.[ & [.c,b.[ c= ].a,b.[ &
    ].a,c1.] c= ].a,b.[ & [.c1,b.[ c= ].a,b.[ by A7,A12,XXREAL_1:48,49; then
A17: ].a,c.] c= dom f & ].a,c.] c= dom g
   & [.c,b.[ c= dom f & [.c,b.[ c= dom g
   & ].a,c1.] c= dom f & ].a,c1.] c= dom g
   & [.c1,b.[ c= dom f & [.c1,b.[ c= dom g by A1,A2;

A18:g is_left_improper_integrable_on a,c
    proof
     per cases;
     suppose c < c1;
      hence g is_left_improper_integrable_on a,c by A7,A17,A13,Th37;
     end;
     suppose A19: c1 <= c;
      g|['c1,c'] is bounded & g is_integrable_on ['c1,c'] by A19,A7,A14;
      hence g is_left_improper_integrable_on a,c by A12,A19,A17,A13,Th38;
     end;
    end;
A20:g is_right_improper_integrable_on c,b
    proof
     per cases;
     suppose A21: c < c1;
      g|['c,c1'] is bounded & g is_integrable_on ['c,c1'] by A21,A7,A13;
      hence g is_right_improper_integrable_on c,b by A21,A12,A17,A14,Th43;
     end;
     suppose c1 <= c;
      hence g is_right_improper_integrable_on c,b by A7,A17,A14,Th42;
     end;
    end;

A22:not (left_improper_integral(g,a,c) = -infty
      & right_improper_integral(g,c,b) = +infty)
    proof
     per cases;
     suppose A23: c < c1; then
A24:   g|['c,c1'] is bounded & g is_integrable_on ['c,c1'] by A7,A13;
A25:   g is_left_improper_integrable_on a,c by A7,A23,A17,A13,Th37;
      g is_right_improper_integrable_on c,b by A23,A12,A17,A24,A14,Th43;
      hence thesis by A15,A12,A17,A7,A23,A24,A25,Th38,Th42;
     end;
     suppose A26: c1 <= c;
A27:   g|['c1,c'] is bounded & g is_integrable_on ['c1,c'] by A26,A7,A14; then
A28:   g is_left_improper_integrable_on a,c by A12,A26,A17,A13,Th38;
      g is_right_improper_integrable_on c,b by A26,A7,A17,A14,Th42;
      hence thesis by A15,A7,A17,A27,A12,A26,A28,Th37,Th43;
     end;
    end;

A29:not (left_improper_integral(g,a,c) = +infty
      & right_improper_integral(g,c,b) = -infty)
    proof
     per cases;
     suppose A30: c < c1; then
A31:   g|['c,c1'] is bounded & g is_integrable_on ['c,c1'] by A7,A13;
A32:   g is_left_improper_integrable_on a,c by A7,A30,A17,A13,Th37;
      g is_right_improper_integrable_on c,b by A30,A12,A17,A31,A14,Th43;
      hence thesis by A16,A12,A17,A7,A30,A31,A32,Th38,Th42;
     end;
     suppose A33: c1 <= c; then
A34:   g|['c1,c'] is bounded & g is_integrable_on ['c1,c'] by A7,A14; then
A35:   g is_left_improper_integrable_on a,c by A12,A33,A17,A13,Th38;
      g is_right_improper_integrable_on c,b by A33,A7,A17,A14,Th42;
      hence thesis by A16,A7,A17,A34,A12,A33,A35,Th37,Th43;
     end;
    end;

A36: improper_integral(f,a,b)
      = left_improper_integral(f,a,c)+right_improper_integral(f,c,b)
       by A1,A3,A7,Th48;
A37: improper_integral(g,a,b)
      = left_improper_integral(g,a,c)+right_improper_integral(g,c,b)
       by A2,A4,A7,Th48; then

A38:not (left_improper_integral(f,a,c) = +infty &
      left_improper_integral(g,a,c) = -infty)
        by A5,A36,A11,A22,XXREAL_3:def 2;

A39:not (left_improper_integral(f,a,c) = -infty &
      left_improper_integral(g,a,c) = +infty)
        by A6,A36,A37,A10,A29,XXREAL_3:def 2;

A40:not (right_improper_integral(f,c,b) = +infty &
      right_improper_integral(g,c,b) = -infty)
        by A5,A36,A37,A10,A29,XXREAL_3:def 2;

A41:not (right_improper_integral(f,c,b) = -infty &
      right_improper_integral(g,c,b) = +infty)
        by A6,A36,A37,A11,A22,XXREAL_3:def 2;

A42:f+g is_left_improper_integrable_on a,c
        by A7,A8,A18,A17,A38,A39,Th57;
A43:left_improper_integral(f+g,a,c)
      = left_improper_integral(f,a,c) + left_improper_integral(g,a,c)
        by A7,A17,A8,A18,A38,A39,Th57;

A44:f+g is_right_improper_integrable_on c,b
        by A7,A17,A9,A20,A40,A41,Th58;

A45:right_improper_integral(f+g,c,b)
      = right_improper_integral(f,c,b) + right_improper_integral(g,c,b)
        by A7,A17,A9,A20,A40,A41,Th58;

A46:now assume A47: left_improper_integral(f+g,a,c) = -infty &
      right_improper_integral(f+g,c,b) = +infty;
     per cases by A10,A22,A43,A45,A47,XXREAL_3:16,17;
     suppose left_improper_integral(f,a,c) = -infty &
      right_improper_integral(g,c,b) = +infty;
      hence contradiction by A6,A10,A36,A37,A22,XXREAL_3:def 2;
     end;
     suppose left_improper_integral(g,a,c) = -infty &
      right_improper_integral(f,c,b) = +infty;
      hence contradiction by A5,A10,A36,A37,A22,XXREAL_3:def 2;
     end;
    end;

A48:now assume A49: left_improper_integral(f+g,a,c) = +infty &
      right_improper_integral(f+g,c,b) = -infty;
     per cases by A11,A29,A45,A49,A43,XXREAL_3:16,17;
     suppose left_improper_integral(f,a,c) = +infty &
      right_improper_integral(g,c,b) = -infty;
      hence contradiction by A5,A11,A36,A37,A29,XXREAL_3:def 2;
     end;
     suppose left_improper_integral(g,a,c) = +infty &
      right_improper_integral(f,c,b) = -infty;
      hence contradiction by A6,A11,A36,A37,A29,XXREAL_3:def 2;
     end;
    end;
    hence
A50:  f+g is_improper_integrable_on a,b by A7,A42,A44,A46;

    dom(f+g) = dom f /\ dom g by VALUED_1:def 1; then
    ].a,b.[ c= dom(f+g) by A1,A2,XBOOLE_1:19; then
A51:improper_integral(f+g,a,b)
     = left_improper_integral(f+g,a,c) + right_improper_integral(f+g,c,b)
       by A7,A50,Th48;

    per cases by XXREAL_0:14;
    suppose A52: left_improper_integral(f+g,a,c) = +infty; then
A53:  left_improper_integral(f,a,c) = +infty or
     left_improper_integral(g,a,c) = +infty by A43,XXREAL_3:16;
A54:  improper_integral(f+g,a,b) = +infty by A52,A48,A51,XXREAL_3:def 2;

     per cases by A53;
     suppose left_improper_integral(f,a,c) = +infty; then
      improper_integral(f,a,b) = +infty by A11,A36,XXREAL_3:def 2;
      hence improper_integral(f+g,a,b)
       = improper_integral(f,a,b)+improper_integral(g,a,b)
        by A5,A54,XXREAL_3:def 2;
     end;
     suppose left_improper_integral(g,a,c) = +infty; then
      improper_integral(g,a,b) = +infty by A37,A29,XXREAL_3:def 2;
      hence improper_integral(f+g,a,b)
       = improper_integral(f,a,b)+improper_integral(g,a,b)
        by A6,A54,XXREAL_3:def 2;
     end;
    end;
    suppose A55: left_improper_integral(f+g,a,c) = -infty; then
A56:  left_improper_integral(f,a,c) = -infty or
     left_improper_integral(g,a,c) = -infty by A43,XXREAL_3:17;
     right_improper_integral(f+g,c,b) <> +infty by A55,A46; then
A57:  improper_integral(f+g,a,b) = -infty by A55,A51,XXREAL_3:def 2;

     per cases by A56;
     suppose left_improper_integral(f,a,c) = -infty; then
      improper_integral(f,a,b) = -infty by A10,A36,XXREAL_3:def 2;
      hence improper_integral(f+g,a,b)
       = improper_integral(f,a,b)+improper_integral(g,a,b)
         by A6,A57,XXREAL_3:def 2;
     end;
     suppose left_improper_integral(g,a,c) = -infty; then
      improper_integral(g,a,b) = -infty by A22,A37,XXREAL_3:def 2;
      hence improper_integral(f+g,a,b)
       = improper_integral(f,a,b)+improper_integral(g,a,b)
         by A5,A57,XXREAL_3:def 2;
     end;
    end;
    suppose A58: left_improper_integral(f+g,a,c) in REAL; then
A59:  left_improper_integral(f,a,c) in REAL &
     left_improper_integral(g,a,c) in REAL
       by A38,A39,A43,XXREAL_3:20; then
     reconsider lf = left_improper_integral(f,a,c),
                lg = left_improper_integral(g,a,c) as Real;
     per cases by XXREAL_0:14;

     suppose A60: right_improper_integral(f+g,c,b) = +infty; then
      right_improper_integral(f,c,b) = +infty or
      right_improper_integral(g,c,b) = +infty by A45,XXREAL_3:16; then
      improper_integral(f,a,b) = +infty or
      improper_integral(g,a,b) = +infty by A59,A36,A37,XXREAL_3:def 2; then
      improper_integral(f,a,b) + improper_integral(g,a,b) = +infty
        by A5,A6,XXREAL_3:def 2;
      hence improper_integral(f+g,a,b)
        = improper_integral(f,a,b)+improper_integral(g,a,b)
        by A58,A60,A51,XXREAL_3:def 2;
     end;
     suppose A61: right_improper_integral(f+g,c,b) = -infty; then
      right_improper_integral(f,c,b) = -infty or
      right_improper_integral(g,c,b) = -infty by A45,XXREAL_3:17; then
      improper_integral(f,a,b) = -infty or
      improper_integral(g,a,b) = -infty by A59,A36,A37,XXREAL_3:def 2; then
      improper_integral(f,a,b) + improper_integral(g,a,b) = -infty
        by A5,A6,XXREAL_3:def 2;
      hence improper_integral(f+g,a,b)
        = improper_integral(f,a,b)+improper_integral(g,a,b)
         by A58,A61,A51,XXREAL_3:def 2;
     end;
     suppose right_improper_integral(f+g,c,b) in REAL; then
      right_improper_integral(f,c,b) in REAL &
      right_improper_integral(g,c,b) in REAL
        by A40,A41,A45,XXREAL_3:20; then
      reconsider rf = right_improper_integral(f,c,b),
                 rg = right_improper_integral(g,c,b) as Real;
      improper_integral(f,a,b) = lf+rf &
      improper_integral(g,a,b) = lg+rg by A36,A37,XXREAL_3:def 2; then
A62:   improper_integral(f,a,b)+improper_integral(g,a,b)
        = lf+rf + (lg+rg) by XXREAL_3:def 2;
      left_improper_integral(f+g,a,c) = lf+lg &
      right_improper_integral(f+g,c,b) = rf+rg
      by A43,A45,XXREAL_3:def 2; then
      improper_integral(f+g,a,b) = lf+lg + (rf+rg) by A51,XXREAL_3:def 2;
      hence improper_integral(f+g,a,b)
        = improper_integral(f,a,b)+improper_integral(g,a,b) by A62;
     end;
    end;
end;

theorem
for f,g be PartFunc of REAL,REAL, a,b be Real st
].a,b.[ c= dom f &
 ].a,b.[ c= dom g & f is_improper_integrable_on a,b &
 g is_improper_integrable_on a,b &
 not (improper_integral(f,a,b) = +infty & improper_integral(g,a,b) = +infty) &
 not (improper_integral(f,a,b) = -infty & improper_integral(g,a,b) = -infty)
 holds
  f-g is_improper_integrable_on a,b &
  improper_integral(f-g,a,b)
   = improper_integral(f,a,b)-improper_integral(g,a,b)
proof
    let f,g be PartFunc of REAL,REAL, a,b be Real;
    assume that
A1: ].a,b.[ c= dom f and
A2: ].a,b.[ c= dom g and
A3: f is_improper_integrable_on a,b and
A4: g is_improper_integrable_on a,b and
A5: not (improper_integral(f,a,b) = +infty
        & improper_integral(g,a,b) = +infty) and
A6: not (improper_integral(f,a,b) = -infty
        & improper_integral(g,a,b) = -infty);
A7: dom(-g) = dom g by VALUED_1:8;
A8: -g is_improper_integrable_on a,b by A2,A4,Th62;
A9:improper_integral(-g,a,b) = - improper_integral(g,a,b) by A2,A4,Th62; then

A10: improper_integral(f,a,b) <> +infty or improper_integral(-g,a,b) <> -infty
      by A5,XXREAL_3:23;

A11: improper_integral(f,a,b) <> -infty or improper_integral(-g,a,b) <> +infty
      by A6,A9,XXREAL_3:23;

    hence f-g is_improper_integrable_on a,b by A1,A2,A3,A7,A8,A10,Th63;
    improper_integral(f-g,a,b)
     = improper_integral(f,a,b) + improper_integral(-g,a,b)
      by A1,A2,A3,A7,A8,A10,A11,Th63
    .=improper_integral(f,a,b) + -improper_integral(g,a,b) by A2,A4,Th62;
    hence improper_integral(f-g,a,b)
      = improper_integral(f,a,b)-improper_integral(g,a,b) by XXREAL_3:def 4;
end;