reserve a,b,i,j,k,l,m,n for Nat;

theorem
  for x,y be Real holds max(x,y) - min(x,y)= |.x-y.|
  proof
    let x,y be Real;
    per cases;
    suppose
      x >= y; then
      min (x,y)= y & max(x,y) = x by XXREAL_0:def 9, def 10;
      hence thesis by ABSVALUE:def 1;
    end;
    suppose
      A1: x < y; then
      A2: min (x,y) = x & max (x,y) = y by XXREAL_0:def 9, def 10;
      x - y < x - x by A1,XREAL_1:10; then
      |.x-y.| = -(x-y) by ABSVALUE:def 1;
      hence thesis by A2;
    end;
  end;
