reserve A for non empty closed_interval Subset of REAL;

theorem Th15:
for f,g be Function of REAL,REAL holds
max(f,g) = (1/2) (#) (f + g + abs(f - g))
proof
 let f,g be Function of REAL,REAL;
 D1: REAL = dom ((1/2) (#) ((f + g)+abs(f - g))) by FUNCT_2:52;
 for x being object st x in dom max(f,g) holds
 max(f,g) . x = ((1/2) (#) ((f + g)+abs(f - g))) . x
 proof
  let x be object;
  assume A0: x in dom max(f,g); then
  A1: x in REAL; then
  A2: x in dom ((f + g)+abs(f - g)) by FUNCT_2:52;
  A3: x in dom(f-g) by A1,FUNCT_2:52;
  A4: x in dom(f+g) by A1,FUNCT_2:52;
  reconsider x as Element of REAL by A0;
  ((1/2) (#) ((f + g)+abs(f - g))) . x
   = (1/2)*(((f + g)+abs(f - g)) . x ) by VALUED_1:6
  .= (1/2)*((f + g).x + abs(f - g).x ) by VALUED_1:def 1,A2
  .= (1/2)*((f + g).x + |. (f - g).x .| ) by VALUED_1:18
  .= (1/2)*((f + g).x + |. f.x - g.x .| ) by VALUED_1:13,A3
  .= (1/2)*((f.x + g.x) + |. f.x - g.x .| ) by VALUED_1:def 1,A4
  .= ((f.x + g.x) + |. f.x - g.x .| ) / 2
  .= max(f.x,g.x) by COMPLEX1:74;
  hence thesis by COUSIN2:def 2;
 end;
 hence thesis by FUNCT_1:2,D1,FUNCT_2:52;
end;
