
theorem Th38:
  for X be non empty set, S be SigmaField of X, f,g be PartFunc of
  X,ExtREAL st f is_simple_func_in S & g is_simple_func_in S holds f+g
  is_simple_func_in S
proof
  let X be non empty set;
  let S be SigmaField of X;
  let f,g be PartFunc of X,ExtREAL;
  assume that
A1: f is_simple_func_in S and
A2: g is_simple_func_in S;
  per cases;
  suppose
A3: dom(f+g) = {};
    reconsider EMPTY = {} as Element of S by PROB_1:4;
    set F = <*EMPTY*>;
A4: dom F = Seg 1 by FINSEQ_1:38;
A5: now
      let i,j be Nat;
      assume that
A6:   i in dom F and
   j in dom F and
   i <> j;
      i = 1 by A4,A6,FINSEQ_1:2,TARSKI:def 1;
      hence F.i misses F.j;
    end;
A9: for n be Nat st n in dom F holds F.n = EMPTY
    proof
      let n be Nat;
      assume n in dom F;
      then n = 1 by A4,FINSEQ_1:2,TARSKI:def 1;
      hence thesis;
    end;
    reconsider F as Finite_Sep_Sequence of S by A5,MESFUNC3:4;
    union rng F = union bool {} by FINSEQ_1:39,ZFMISC_1:1;
    then
A10: dom(f+g) = union rng F by A3,ZFMISC_1:81;
    for x be Element of X st x in dom(f+g) holds |. (f+g).x .| < +infty by A3;
    then
A11: f+g is real-valued by MESFUNC2:def 1;
    for n being Nat for x,y be Element of X st n in dom F & x in F.n & y
    in F.n holds (f+g).x = (f+g).y by A9;
    hence thesis by A11,A10,MESFUNC2:def 4;
  end;
  suppose
A12: dom(f+g) <> {};
A13: (f|dom(f+g))"{+infty} = dom(f+g) /\ f"{+infty} by FUNCT_1:70;
    g is without+infty by A2,Th14;
    then not +infty in rng g;
    then
A14: g"{+infty} = {} by FUNCT_1:72;
A15: (g|dom(f+g))"{+infty} = dom(f+g) /\ g"{+infty} by FUNCT_1:70;
    f is without+infty by A1,Th14;
    then not +infty in rng f;
    then
A16: f"{+infty} = {} by FUNCT_1:72;
    then
A17: (dom f /\ dom g)\(f"{+infty}/\g"{-infty} \/ f"{-infty}/\g"{+infty })
    = dom f /\ dom g by A14;
    then
A18: dom(f+g) = dom f /\ dom g by MESFUNC1:def 3;
    dom(f|dom(f+g)) = dom f /\ dom(f+g) by RELAT_1:61;
    then
A19: dom(f|dom(f+g)) = dom f /\ dom f /\ dom g by A18,XBOOLE_1:16;
    then
A20: dom(f|dom(f+g)) = dom(f+g) by A17,MESFUNC1:def 3;
A21: dom g is Element of S by A2,Th37;
    dom f is Element of S by A1,Th37;
    then
A22: dom(f+g) in S by A18,A21,FINSUB_1:def 2;
    then
A23: g|dom(f+g) is_simple_func_in S by A2,Th34;
    dom(g|dom(f+g)) = dom g /\ dom(f+g) by RELAT_1:61;
    then
A24: dom(g|dom(f+g)) = dom g /\ dom g /\ dom f by A18,XBOOLE_1:16;
    then
A25: dom(g|dom(f+g)) = dom(f+g) by A17,MESFUNC1:def 3;
A26: dom(f|dom(f+g) + g|dom(f+g)) = (dom(f|dom(f+g)) /\ dom(g|dom(f+g))) \
(((f|dom(f+g))"{+infty} /\ (g|dom(f+g))"{-infty}) \/ ((f|dom(f+g))"{-infty} /\
    (g|dom(f+g))"{+infty})) by MESFUNC1:def 3
      .= dom(f+g) by A16,A14,A17,A19,A24,A13,A15,MESFUNC1:def 3;
A27: for x be Element of X st x in dom(f|dom(f+g) + g|dom(f+g)) holds (f|
    dom(f+g) + g|dom(f+g)).x = (f+g).x
    proof
      let x be Element of X;
      assume
A28:  x in dom(f|dom(f+g) + g|dom(f+g));
      then (f|dom(f+g) + g|dom(f+g)).x = (f|dom(f+g)).x + (g|dom(f+g)).x by
MESFUNC1:def 3
        .= f.x + (g|dom(f+g)).x by A26,A28,FUNCT_1:49
        .= f.x + g.x by A26,A28,FUNCT_1:49;
      hence thesis by A26,A28,MESFUNC1:def 3;
    end;
    f|dom(f+g) is_simple_func_in S by A1,A22,Th34;
    then f|dom(f+g) + g|dom(f+g) is_simple_func_in S by A12,A23,A20,A25,Lm3;
    hence thesis by A26,A27,PARTFUN1:5;
  end;
end;
