reserve A for non empty closed_interval Subset of REAL;

theorem
for a,b,c be Real, f,g,h be Function of REAL,REAL st
a <= b & b <= c & f is continuous & g is continuous &
h  = (f| [.a,b.]) +* (g | [.b,c.]) & f.b = g.b
holds
integral((id REAL) (#) h,['a,c'])
= integral((id REAL) (#) f,['a,b']) + integral((id REAL) (#) g,['b,c'])
proof
 let a,b,c be Real, f,g,h be Function of REAL,REAL;
 assume that
 A1: a <= b & b <= c and
 A2: f is continuous & g is continuous and
 A3: h  = (f| [.a,b.]) +* (g | [.b,c.]) and
 A4: f.b = g.b;
A55: dom f = REAL & dom g = REAL by FUNCT_2:def 1;
 set A = ['a,c'];
 reconsider ff = f as PartFunc of REAL,REAL;
 reconsider gg = g as PartFunc of REAL,REAL;
 A2a: ff | A is continuous & gg | A is continuous by A2;
  f is_integrable_on ['a,c'] & f | ['a,c'] is bounded &
       g is_integrable_on ['a,c'] & g | ['a,c'] is bounded
 by INTEGRA5:11,INTEGRA5:10,A2a,A55; then
 B12: (id REAL) (#) f is_integrable_on ['a,c'] &
     ((id REAL) (#) f) | ['a,c'] is bounded &
      (id REAL) (#) g is_integrable_on ['a,c'] &
     ((id REAL) (#) g) | ['a,c'] is bounded by Lm3;
 set
   G = ((id REAL) (#) f)| [.a,b.] +* ((id REAL) (#) g )| [.b,c.];
 B3a: dom G
  = dom(((id REAL) (#) f)| [.a,b.])
  \/ dom(((id REAL) (#) g )| [.b,c.]) by FUNCT_4:def 1
  .= [.a,b.]
  \/ dom(((id REAL) (#) g )| [.b,c.]) by FUNCT_2:def 1
  .= [.a,b.] \/ [.b,c.] by FUNCT_2:def 1
  .=[. a,c .] by XXREAL_1:165,A1;
  AC: REAL /\ [.a,c.] c= [. a,c .] & [. a,c .]  c= REAL /\ [.a,c.]
         by XBOOLE_0:def 4;
  B3b: [. a,c .]
   = REAL /\ [.a,c.] by AC,XBOOLE_0:def 10
  .= (dom (id REAL (#) h)) /\ [.a,c.] by FUNCT_2:def 1;
 for x being object st x in dom G holds G . x = (id REAL (#) h) . x
 proof
  let x be object;
  assume Gx: x in dom G; then
  reconsider x as Real by B3a;
  C1: a <= x & x <= c by XXREAL_1:1,Gx,B3a;
  per cases;
   suppose b <= x; then
   CC: x in [.b,c.] by C1; then
    CC1:x in dom (((id REAL) (#) g )| [.b,c.]) by FUNCT_2:def 1;
    CC2:x in dom ( g | [.b,c.]) by CC,FUNCT_2:def 1;
     G . x
     = (((id REAL) (#) g )| [.b,c.]).x by FUNCT_4:13,CC1
     .= ((id REAL) (#) g ).x by FUNCT_1:49,CC
     .= (id REAL).x * g .x by VALUED_1:5
     .= (id REAL).x * (g | [.b,c.]) . x by FUNCT_1:49,CC
     .= (id REAL).x *  (((f| [.a,b.]) +* (g | [.b,c.])) . x) by CC2,FUNCT_4:13
     .= (id REAL (#) h) . x by A3,VALUED_1:5;
    hence thesis;
   end;
   suppose DX: x < b; then
    CCa: x in [.a,b.] by C1;
    DD1: not x in dom (((id REAL) (#) g )| [.b,c.]) by XXREAL_1:1,DX;
    DD2: not x in dom ( g | [.b,c.]) by XXREAL_1:1,DX;
     G . x
     = (((id REAL) (#) f )| [.a,b.]).x by FUNCT_4:11,DD1
     .= ((id REAL) (#) f ).x by FUNCT_1:49,CCa
     .= (id REAL).x * f .x by VALUED_1:5
     .= (id REAL).x * (f | [.a,b.]) . x by FUNCT_1:49,CCa
     .= (id REAL).x *  (((f| [.a,b.]) +* (g | [.b,c.])) . x) by DD2,FUNCT_4:11
     .= (id REAL (#) h) . x by A3,VALUED_1:5;
    hence thesis;
   end;
 end;
 then
 B3: (id REAL (#) h) | [.a,c.]
   = ((id REAL) (#) f)| [.a,b.] +* ((id REAL) (#) g )| [.b,c.]
     by FUNCT_1:46,B3a,B3b;
 B4: ((id REAL) (#) f).b
  = (id REAL).b * g.b by A4,VALUED_1:5
 .= ((id REAL) (#) g).b by VALUED_1:5;
 h is continuous by Th24,A1,A2,A3,A4; then
 (id REAL) (#) h is_integrable_on ['a,c'] by integra51011;
 hence integral((id REAL) (#) h,['a,c'])
 = integral((id REAL) (#) f,['a,b']) + integral((id REAL) (#) g,['b,c'])
 by Th18Z,A1,B12,B3,B4;
end;
