
theorem Th40:
  for X be non empty set, S be SigmaField of X, M be sigma_Measure
  of S, f,g be PartFunc of X,ExtREAL st f is_simple_func_in S & g
is_simple_func_in S &
(for x be object st x in dom(f-g) holds g.x <= f.x) holds f-g is nonnegative
proof
  let X be non empty set, S be SigmaField of X, M be sigma_Measure of S, f,g
  be PartFunc of X,ExtREAL such that
A1: f is_simple_func_in S and
A2: g is_simple_func_in S and
A3: for x be object st x in dom(f-g) holds g.x <= f.x;
  g is without-infty by A2,Th14;
  then not -infty in rng g;
  then
A4: g"{-infty} = {} by FUNCT_1:72;
  f is without+infty by A1,Th14;
  then not +infty in rng f;
  then
A5: f"{+infty} = {} by FUNCT_1:72;
  then
  (dom f /\ dom g) \ (f"{+infty}/\g"{+infty} \/ f"{-infty}/\g"{-infty}) =
  dom f /\ dom g by A4;
  then
A6: dom (f-g) = dom f /\ dom g by MESFUNC1:def 4;
  for x be set st x in dom f /\ dom g holds g.x <= f.x & -infty < g.x & f
  .x < +infty
  proof
    let x be set;
    assume
A7: x in dom f /\ dom g;
    hence g.x <= f.x by A3,A6;
    x in dom g by A7,XBOOLE_0:def 4;
    then not g.x in {-infty} by A4,FUNCT_1:def 7;
    then not g.x = -infty by TARSKI:def 1;
    hence -infty < g.x by XXREAL_0:6;
    x in dom f by A7,XBOOLE_0:def 4;
    then not f.x in {+infty} by A5,FUNCT_1:def 7;
    then not f.x = +infty by TARSKI:def 1;
    hence thesis by XXREAL_0:4;
  end;
  hence thesis by Th21;
end;
