reserve x,y,z,r,s for ExtReal;
reserve A,B for ext-real-membered set;

theorem
  max(x,y) = max{x,y}
proof
  now
    per cases;
    case
A1:   x <= y;
A2:   for z being UpperBound of {x,y} holds y <= z by Lm4;
      y is UpperBound of {x,y} by A1,Lm3;
      hence max{x,y} = y by A2,Def3;
    end;
    case
A3:   y < x;
A4:   for z being UpperBound of {x,y} holds x <= z by Lm4;
      x is UpperBound of {x,y} by A3,Lm3;
      hence max{x,y} = x by A4,Def3;
    end;
  end;
  hence thesis by XXREAL_0:def 10;
end;
