reserve X for non empty set;
reserve e for set;
reserve x for Element of X;
reserve f,g for PartFunc of X,ExtREAL;
reserve S for SigmaField of X;
reserve F for Function of RAT,S;
reserve p,q for Rational;
reserve r for Real;
reserve n,m for Nat;
reserve A,B for Element of S;

theorem
  for C being non empty set, f being PartFunc of C,ExtREAL holds
  |.f.| = max+(f) + max-(f)
proof
  let C be non empty set;
  let f be PartFunc of C,ExtREAL;
A1: dom f = dom(max+(f)+max-(f)) by Th17;
A2: dom f = dom |.f.| by MESFUNC1:def 10;
 for x being Element of C st x in dom f holds
  |.f.| .x = (max+(f) + max-(f)).x
  proof
    let x be Element of C;
    assume
A3: x in dom f;
 now per cases by Th18;
      suppose
A4:     max+(f).x = f.x;
then A5:     max+(f).x + max-(f).x = f.x + 0. by Th19
          .= f.x by XXREAL_3:4;
     x in dom(max+(f)) by A3,Def2;
then      max+(f).x = max(f.x,0.) by Def2;
then     0. <= f.x by A4,XXREAL_0:def 10;
then     f.x = |. f.x .| by EXTREAL1:def 1
          .= |.f.| .x by A2,A3,MESFUNC1:def 10;
        hence thesis by A1,A3,A5,MESFUNC1:def 3;
      end;
      suppose
A6:    max+(f).x = 0.;
then A7:    max+(f).x + max-(f).x = 0. + -(f.x) by A3,Th20
          .= -(f.x) by XXREAL_3:4;
    x in dom(max+(f)) by A3,Def2;
then     max+(f).x = max(f.x,0.) by Def2;
then     f.x <= 0. by A6,XXREAL_0:def 10;
then     -(f.x) = |. f.x .| by EXTREAL1:18
          .= |.f.| .x by A2,A3,MESFUNC1:def 10;
        hence thesis by A1,A3,A7,MESFUNC1:def 3;
      end;
    end;
    hence thesis;
  end;
  hence thesis by A1,A2,PARTFUN1:5;
end;
