reserve a,b,r,g for Real;

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