reserve X for non empty set,
  S for SigmaField of X,
  M for sigma_Measure of S,
  E for Element of S,
  F,G for Functional_Sequence of X,ExtREAL,
  I for ExtREAL_sequence,
  f,g for PartFunc of X,ExtREAL,
  seq, seq1, seq2 for ExtREAL_sequence,
  p for ExtReal,
  n,m for Nat,
  x for Element of X,
  z,D for set;

theorem
  Integral(M,chi(E,X)) = M.E & Integral(M,(chi(E,X))|E) = M.E
proof
  reconsider XX = X as Element of S by MEASURE1:7;
  set F = XX \ E;
A1: now
    let x be Element of X;
    assume
A2: x in dom(max- chi(E,X));
    per cases;
    suppose
      x in E;
      then chi(E,X).x = 1 by FUNCT_3:def 3;
      then max(-(chi(E,X).x),0.) = 0. by XXREAL_0:def 10;
      hence (max-(chi(E,X))).x = 0 by A2,MESFUNC2:def 3;
    end;
    suppose
      not x in E;
      then chi(E,X).x = 0. by FUNCT_3:def 3;
      then -chi(E,X).x = 0;
      then max(-(chi(E,X).x),0.) = 0;
      hence (max-(chi(E,X))).x = 0 by A2,MESFUNC2:def 3;
    end;
  end;
A3: XX = dom chi(E,X) by FUNCT_3:def 3;
  then
A4: XX = dom(max+(chi(E,X))) by MESFUNC7:23;
A5: XX /\ F = F by XBOOLE_1:28;
  then
A6: dom((max+(chi(E,X)))|F) = F by A4,RELAT_1:61;
A7: now
    let x be Element of X;
    assume
A8: x in dom((max+(chi(E,X)))|F);
    then chi(E,X).x = 0 by A6,FUNCT_3:37;
    then (max+(chi(E,X))).x = 0 by MESFUNC7:23;
    hence ((max+(chi(E,X)))|F).x = 0 by A8,FUNCT_1:47;
  end;
A9: chi(E,X) is XX-measurable by MESFUNC2:29;
  then
A10: max+(chi(E,X)) is XX-measurable by MESFUNC7:23;
  then max+(chi(E,X)) is F-measurable by MESFUNC1:30;
  then
A11: integral+(M,(max+ chi(E,X))|F) = 0 by A4,A5,A6,A7,MESFUNC5:42,87;
A12: XX /\ E = E by XBOOLE_1:28;
  then
A13: dom((max+(chi(E,X)))|E) = E by A4,RELAT_1:61;
  E \/ F = XX by A12,XBOOLE_1:51;
  then
A14: (max+ chi(E,X))|(E\/F) = max+ chi(E,X);
A15: for x be object st x in dom max+(chi(E,X)) holds 0. <= (max+(chi(E,X))).x
  by MESFUNC2:12;
  then
A16: max+(chi(E,X)) is nonnegative by SUPINF_2:52;
  then integral+(M,(max+ chi(E,X))|(E\/F)) = integral+(M,(max+ chi(E,X))|E) +
  integral+(M,(max+ chi(E,X))|F) by A4,A10,MESFUNC5:81,XBOOLE_1:79;
  then
A17: integral+(M,max+ chi(E,X)) = integral+(M,(max+ chi(E,X))|E) by A14,A11,
XXREAL_3:4;
A18: now
    let x be object;
    assume
A19: x in dom((max+(chi(E,X)))|E);
    then chi(E,X).x = 1 by A13,FUNCT_3:def 3;
    then (max+(chi(E,X))).x = 1 by MESFUNC7:23;
    hence ((max+(chi(E,X)))|E).x = 1 by A19,FUNCT_1:47;
  end;
  then (max+(chi(E,X)))|E is_simple_func_in S by A13,MESFUNC6:2;
  then integral+(M,max+ chi(E,X)) = integral'(M,(max+ chi(E,X))|E) by A16,A17,
MESFUNC5:15,77;
  then
A20: integral+(M,max+ chi(E,X)) =  jj * M.(dom((max+(chi(E,X)))|E))
   by A13,A18,MESFUNC5:104;
  max+(chi(E,X)) is E-measurable by A10,MESFUNC1:30;
  then (max+(chi(E,X)))|E is E-measurable by A4,A12,MESFUNC5:42;
  then
A21: (chi(E,X))|E is E-measurable by MESFUNC7:23;
  (max+(chi(E,X)))|E is nonnegative by A15,MESFUNC5:15,SUPINF_2:52;
  then
A22: (chi(E,X))|E is nonnegative by MESFUNC7:23;
  E = dom((chi(E,X))|E) by A13,MESFUNC7:23;
  then
A23: Integral(M,(chi(E,X))|E) =integral+(M,(chi(E,X))|E) by A21,A22,MESFUNC5:88
;
  XX = dom(max- chi(E,X)) by A3,MESFUNC2:def 3;
  then integral+(M,max- chi(E,X)) = 0 by A3,A9,A1,MESFUNC2:26,MESFUNC5:87;
  then Integral(M,chi(E,X)) =  1 * M.E by A13,A20,XXREAL_3:15;
  hence Integral(M,chi(E,X)) = M.E by XXREAL_3:81;
  (chi(E,X))|E = (max+ chi(E,X))|E by MESFUNC7:23;
  hence thesis by A13,A17,A20,A23,XXREAL_3:81;
end;
